+#ifndef _MSC_VER
+ /* the data pointedd too by dirname might change too (bsd) */
+ if (NULL == (base_dir = strdup(dirname(pathname_copy)))) {
+ free(pathname_copy);
+ return -1;
+ }
+#else
+ _splitpath(pathname_copy, NULL, base_dir, NULL, NULL);
+#endif