diff --git a/Source/utils/paths.cpp b/Source/utils/paths.cpp index 7785e543c..382ec1e8a 100644 --- a/Source/utils/paths.cpp +++ b/Source/utils/paths.cpp @@ -21,6 +21,7 @@ namespace paths { namespace { +std::optional appPath; std::optional basePath; std::optional prefPath; std::optional configPath; @@ -50,10 +51,18 @@ std::string FromSDL(char *s) } // namespace +const std::string &AppPath() +{ + if (!appPath) { + appPath = FromSDL(SDL_GetBasePath()); + } + return *appPath; +} + const std::string &BasePath() { if (!basePath) { - basePath = FromSDL(SDL_GetBasePath()); + basePath = AppPath(); } return *basePath; } diff --git a/Source/utils/paths.h b/Source/utils/paths.h index b98c6690d..c1444ffb6 100644 --- a/Source/utils/paths.h +++ b/Source/utils/paths.h @@ -6,6 +6,7 @@ namespace devilution { namespace paths { +const std::string &AppPath(); const std::string &BasePath(); const std::string &PrefPath(); const std::string &ConfigPath();