Browse Source

Introduce paths::AppPath

pull/3080/head
obligaron 4 years ago committed by Anders Jenbo
parent
commit
a532d0fc21
  1. 11
      Source/utils/paths.cpp
  2. 1
      Source/utils/paths.h

11
Source/utils/paths.cpp

@ -21,6 +21,7 @@ namespace paths {
namespace {
std::optional<std::string> appPath;
std::optional<std::string> basePath;
std::optional<std::string> prefPath;
std::optional<std::string> 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;
}

1
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();

Loading…
Cancel
Save