From: Thomas Debesse Date: Thu, 23 Dec 2021 00:00:34 +0000 (+0100) Subject: radiant: store preferences in Library/Application Support on macOS X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=924b92f689668a16fbc2cf2280bee6cf065584c5;p=xonotic%2Fnetradiant.git radiant: store preferences in Library/Application Support on macOS --- diff --git a/radiant/environment.cpp b/radiant/environment.cpp index d6be70d5..f7975518 100644 --- a/radiant/environment.cpp +++ b/radiant/environment.cpp @@ -302,17 +302,30 @@ void environment_init( int argc, char const* argv[] ){ } if ( !portable_app_setup() ) { - // this is used on both Linux and macOS - // but a macOS specific code may be written instead 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(); } + gamedetect(); }