]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
pick apart com_argv[0] to find basedir in Mac OSX when running from a .app package
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 30 May 2005 22:34:17 +0000 (22:34 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 30 May 2005 22:34:17 +0000 (22:34 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5362 d7cf8633-e32d-0410-b094-e92efae38249

fs.c

diff --git a/fs.c b/fs.c
index 6f7a4fc83a2829863396fd2cef3ff72203811924..0b72b4d125200fc3d0fdb8609dd35764f4f987f2 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -908,7 +908,15 @@ void FS_Init (void)
 #ifdef MACOSX
        // FIXME: is there a better way to find the directory outside the .app?
        if (strstr(com_argv[0], ".app/"))
-               strcpy(fs_basedir, "../../..");
+       {
+               char *split;
+               char temp[4096];
+               split = strstr(com_argv[0], ".app/");
+               while (split > com_argv[0] && *split != '/')
+                       split--;
+               strlcpy(fs_basedir, com_argv[0], sizeof(fs_basedir));
+               fs_basedir[split - com_argv[0]] = 0;
+       }
 #endif
 
        PK3_OpenLibrary ();