From: Thomas Debesse Date: Sun, 25 Nov 2018 00:35:12 +0000 (+0100) Subject: q3map2: use ~/Library/Application Support on Mac X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=commitdiff_plain;h=735f18c744a4d36648871cac51e606d935b6bfd4 q3map2: use ~/Library/Application Support on Mac --- diff --git a/tools/quake3/q3map2/path_init.c b/tools/quake3/q3map2/path_init.c index 725f2bbf..96b33fcb 100644 --- a/tools/quake3/q3map2/path_init.c +++ b/tools/quake3/q3map2/path_init.c @@ -45,9 +45,15 @@ 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