physfs.c
changeset 100 d2f04ab4b412
parent 93 74d1df359be3
child 101 bd18e17ad6ad
--- a/physfs.c	Fri Sep 14 22:58:04 2001 +0000
+++ b/physfs.c	Fri Sep 14 22:59:53 2001 +0000
@@ -340,7 +340,19 @@
     /*
      * Last ditch effort: it's the current working directory. (*shrug*)
      */
-    return(__PHYSFS_platformCurrentDir());
+    retval = __PHYSFS_platformCurrentDir();
+    if(retval != NULL) {
+	return(retval);
+    }
+
+    /*
+     * Ok, current directory doesn't exist, use the root directory.
+     * Not a good alternative, but it only happens if the current
+     * directory was deleted from under the program.
+     */
+    retval = (char *) malloc(strlen(dirsep) + 1);
+    strcpy(retval, dirsep);
+    return(retval);
 } /* calculateBaseDir */