radiant: check Linux prefix against XDG_DATA_HOME before HOME
authorThomas Debesse <dev@illwieckz.net>
Sat, 24 Nov 2018 22:06:59 +0000 (23:06 +0100)
committerThomas Debesse <dev@illwieckz.net>
Sat, 18 May 2019 21:11:29 +0000 (23:11 +0200)
radiant/mainframe.cpp

index f43268a..225a7d5 100644 (file)
@@ -256,9 +256,17 @@ void HomePaths_Realise(){
 
 #if (GDEF_OS_POSIX && !GDEF_OS_MACOS)
                        path.clear();
-                       path << DirectoryCleaned( g_get_home_dir() ) << prefix << "/";
-                       g_qeglobals.m_userEnginePath = path.c_str();
-                       break;
+                       path << DirectoryCleaned( g_get_user_data_dir() ) << ( prefix + 1 ) << "/";
+                       if ( file_exists( path.c_str() ) && file_is_directory( path.c_str() ) ) {
+                               g_qeglobals.m_userEnginePath = path.c_str();
+                               break;
+                       }
+                       else {
+                               path.clear();
+                               path << DirectoryCleaned( g_get_home_dir() ) << prefix << "/";
+                               g_qeglobals.m_userEnginePath = path.c_str();
+                               break;
+                       }
 #endif
                }