From ec831ed00f616968a3a3ea837b09cfe52f16949c Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Mon, 5 Feb 2018 03:54:58 +0100 Subject: [PATCH] =?utf8?q?restore=20=E2=80=9Copen=20userGamePath/maps/?= =?utf8?q?=E2=80=9D=20behavior=20when=20LastMapFolder=20unset?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The former behavior when LastMapFolder was not implemented was to try to open maps/ dir in userGamePath. When LastMapFolder code was written the code only looked for userGamePath, this is restoring that behavior, mimicking the code for model opening that does the same with userGamePath/models. As an extra, it also fallback on userGamePath is maps/ is missing. --- radiant/map.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/radiant/map.cpp b/radiant/map.cpp index 06c5f48c..9b8e7f90 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -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(); -- 2.39.2