]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/map.cpp
restore “open userGamePath/maps/” behavior when LastMapFolder unset
[xonotic/netradiant.git] / radiant / map.cpp
index 06c5f48cf3a47c16a1ecd01035211bbc216f712e..9b8e7f90b0abc6d746480f34148aae6b7c35ce53 100644 (file)
@@ -59,6 +59,7 @@ MapModules &ReferenceAPI_getMapModules();
 #include "cmdlib.h"
 #include "stream/textfilestream.h"
 #include "os/path.h"
+#include "os/file.h"
 #include "uniquenames.h"
 #include "modulesystem/singletonmodule.h"
 #include "modulesystem/moduleregistry.h"
@@ -1945,7 +1946,13 @@ const char *getLastMapFolderPath()
     if (g_strLastMapFolder.empty()) {
         GlobalPreferenceSystem().registerPreference("LastMapFolder", make_property_string(g_strLastMapFolder));
         if (g_strLastMapFolder.empty()) {
-            g_strLastMapFolder = g_qeglobals.m_userGamePath;
+            StringOutputStream buffer(1024);
+            buffer << getMapsPath();
+            if (!file_readable(buffer.c_str())) {
+                buffer.clear();
+                buffer << g_qeglobals.m_userGamePath.c_str() << "/";
+            }
+            g_strLastMapFolder = buffer.c_str();
         }
     }
     return g_strLastMapFolder.c_str();