]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
radiant: store preferences in Library/Application Support on macOS
authorThomas Debesse <dev@illwieckz.net>
Thu, 23 Dec 2021 00:00:34 +0000 (01:00 +0100)
committerThomas Debesse <dev@illwieckz.net>
Fri, 24 Dec 2021 17:04:21 +0000 (18:04 +0100)
radiant/environment.cpp

index d6be70d54a6b1eb1db87d3f368d9fc1d2ed49499..f79755183bb7682456369cd7fb38c26013328542 100644 (file)
@@ -302,17 +302,30 @@ void environment_init( int argc, char const* argv[] ){
        }
 
        if ( !portable_app_setup() ) {
        }
 
        if ( !portable_app_setup() ) {
-               // this is used on both Linux and macOS
-               // but a macOS specific code may be written instead
                StringOutputStream home( 256 );
                StringOutputStream home( 256 );
-               home << DirectoryCleaned(g_get_user_config_dir()) << "/" << RADIANT_BASENAME << "/";
-               // first create ~/.config
-               // since it may be missing on brand new home directory
-               Q_mkdir( g_get_user_config_dir() );
-               // then create ~/.config/netradiant
+#if GDEF_OS_MACOS
+               /* This is used on macOS, this will produce
+               ~/Library/Application Support/NetRadiant folder. */
+               home << DirectoryCleaned( g_get_home_dir() );
+               Q_mkdir( home.c_str() );
+               home << "Library/";
+               Q_mkdir( home.c_str() );
+               home << "Application Support/";
+               Q_mkdir( home.c_str() );
+               home << RADIANT_NAME << "/";
+#else // if GDEF_OS_XDG
+               /* This is used on both Linux and FreeBSD,
+               this will produce ~/.config/netradiant folder
+               when environment has default settings, the
+               XDG_CONFIG_HOME variable modifies it. */
+               home << DirectoryCleaned( g_get_user_config_dir() );
+               Q_mkdir( home.c_str() );
+               home << RADIANT_BASENAME << "/";
+#endif // ! GDEF_OS_MACOS
                Q_mkdir( home.c_str() );
                home_path = home.c_str();
        }
                Q_mkdir( home.c_str() );
                home_path = home.c_str();
        }
+
        gamedetect();
 }
 
        gamedetect();
 }