Browse Source

AssetsPath: Default to exe dir

Also adds `SetAssetsPath`, for use by tests.
pull/3773/head
Gleb Mazovetskiy 4 years ago committed by Anders Jenbo
parent
commit
f5d8f513cb
  1. 8
      Source/utils/paths.cpp
  2. 1
      Source/utils/paths.h

8
Source/utils/paths.cpp

@ -91,7 +91,7 @@ const std::string &ConfigPath()
const std::string &AssetsPath()
{
if (!assetsPath)
assetsPath.emplace(BasePath() + "assets/");
assetsPath.emplace(FromSDL(SDL_GetBasePath()) + "assets/");
return *assetsPath;
}
@ -118,6 +118,12 @@ void SetConfigPath(const std::string &path)
AddTrailingSlash(*configPath);
}
void SetAssetsPath(const std::string &path)
{
assetsPath = path;
AddTrailingSlash(*assetsPath);
}
void SetMpqDir(const std::string &path)
{
mpqDir = std::string(path);

1
Source/utils/paths.h

@ -17,6 +17,7 @@ const std::optional<std::string> &MpqDir();
void SetBasePath(const std::string &path);
void SetPrefPath(const std::string &path);
void SetConfigPath(const std::string &path);
void SetAssetsPath(const std::string &path);
void SetMpqDir(const std::string &path);
} // namespace paths

Loading…
Cancel
Save