]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
q3map2: use ~/Library/Application Support on Mac
authorThomas Debesse <dev@illwieckz.net>
Sun, 25 Nov 2018 00:35:12 +0000 (01:35 +0100)
committerThomas Debesse <dev@illwieckz.net>
Sat, 18 May 2019 21:11:32 +0000 (23:11 +0200)
tools/quake3/q3map2/path_init.c

index 725f2bbf81b9a75713eeb71012792430409448b5..96b33fcbae6d39cfd9decb777018d76d94f5845a 100644 (file)
 
 qboolean                               customHomePath = qfalse;
 char                    *homePath;
+
+#if GDEF_OS_MACOS
+char                                   *macLibraryApplicationSupportPath;
+#endif
+
 #if (GDEF_OS_POSIX && !GDEF_OS_MACOS)
 char                    *xdgDataHomePath;
 #endif // (GDEF_OS_POSIX && !GDEF_OS_MACOS)
+
 char installPath[ MAX_OS_PATH ];
 
 int numBasePaths;
@@ -117,6 +123,12 @@ void LokiInitPaths( char *argv0 ){
                home = homePath;
        }
 
+       #if GDEF_OS_MACOS
+               char *subPath = "/Library/Application Support";
+               macLibraryApplicationSupportPath = safe_malloc( sizeof( char ) * ( strlen( home ) + strlen( subPath ) ) );
+               sprintf( macLibraryApplicationSupportPath, "%s%s", home, subPath );
+       #endif // GDEF_OS_MACOS
+
        #if (GDEF_OS_POSIX && !GDEF_OS_MACOS)
        xdgDataHomePath = getenv( "XDG_DATA_HOME" );
 
@@ -324,6 +336,22 @@ void AddHomeBasePath( char *path ){
                char *tempHomePath;
                tempHomePath = homePath;
 
+               /* homePath is . on Windows if not user supplied */
+
+               #if GDEF_OS_MACOS
+               /*
+                  use ${HOME}/Library/Application as ${HOME}
+                  if home path is not user supplied
+                  and strip the leading dot from prefix in any case
+                 
+                  basically it produces
+                  ${HOME}/Library/Application/unvanquished
+                  /user/supplied/home/path/unvanquished
+               */
+               tempHomePath = macLibraryApplicationSupportPath;
+               path = path + 1;
+               #endif // GDEF_OS_MACOS
+
                #if (GDEF_OS_POSIX && !GDEF_OS_MACOS)
                /*
                   on Linux, check if game uses ${XDG_DATA_HOME}/prefix instead of ${HOME}/.prefix