From de3f30623b184147a591c688d709aaa0cf8f13d6 Mon Sep 17 00:00:00 2001 From: Trihedraf Date: Sun, 2 May 2021 03:58:01 -0700 Subject: [PATCH] if Writeable diablo.ini in PWD use that and save saves to PWD --- Source/utils/paths.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/utils/paths.cpp b/Source/utils/paths.cpp index 2505ce0f2..3104f0c47 100644 --- a/Source/utils/paths.cpp +++ b/Source/utils/paths.cpp @@ -3,6 +3,7 @@ #include #include "utils/stdcompat/optional.hpp" +#include "utils/file_util.h" #include "utils/log.hpp" #ifdef USE_SDL1 @@ -69,15 +70,23 @@ const std::string &BasePath() const std::string &PrefPath() { - if (!prefPath) + if (!prefPath) { prefPath = FromSDL(SDL_GetPrefPath("diasurgical", "devilution")); + if (FileExistsAndIsWriteable("diablo.ini")) { + prefPath = "./"; + } + } return *prefPath; } const std::string &ConfigPath() { - if (!configPath) + if (!configPath) { configPath = FromSDL(SDL_GetPrefPath("diasurgical", "devilution")); + if (FileExistsAndIsWriteable("diablo.ini")) { + configPath = "./"; + } + } return *configPath; }