diff options
Diffstat (limited to 'src/dirs.cpp')
-rw-r--r-- | src/dirs.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/dirs.cpp b/src/dirs.cpp index 131e8a090..2e88aef81 100644 --- a/src/dirs.cpp +++ b/src/dirs.cpp @@ -42,6 +42,7 @@ #include "utils/cast.h" #include "utils/gettext.h" +#include "utils/performance.h" #ifdef ANDROID #ifdef USE_SDL2 @@ -55,14 +56,14 @@ #include <CoreFoundation/CFBundle.h> #endif // __APPLE__ -#ifdef WIN32 +#ifdef _WIN32 PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") #include <SDL_syswm.h> PRAGMA48(GCC diagnostic pop) #include "fs/specialfolder.h" #undef ERROR -#endif // WIN32 +#endif // _WIN32 #include <sys/stat.h> @@ -244,23 +245,20 @@ void Dirs::mountDataDir() Append_false); #endif // defined __native_client__ -#ifndef WIN32 - // Add branding/data to VirtFS search path +#ifndef _WIN32 + // Add branding file's possibly adjecent data/ to VirtFS search path if (!settings.options.brandingPath.empty()) { std::string path = settings.options.brandingPath; - // Strip blah.manaplus from the path + // Strip *.mana from the path const int loc = CAST_S32(path.find_last_of('/')); if (loc > 0) - { - VirtFs::mountDir(path.substr( - 0, loc + 1).append("data"), - Append_false); - } + VirtFs::mountDir(path.substr(0, loc + 1).append("data"), + Append_false); } -#endif // WIN32 +#endif // _WIN32 } void Dirs::initRootDir() @@ -348,7 +346,7 @@ void Dirs::initLocalDataDir() #elif defined __HAIKU__ settings.localDataDir = pathJoin(VirtFs::getUserDir(), "config/cache/Mana"); -#elif defined WIN32 +#elif defined _WIN32 settings.localDataDir = getSpecialFolderLocation(CSIDL_LOCAL_APPDATA); if (settings.localDataDir.empty()) settings.localDataDir = VirtFs::getUserDir(); @@ -376,7 +374,7 @@ void Dirs::initLocalDataDir() "Exiting."), settings.localDataDir.c_str())); } #ifdef USE_PROFILER - Perfomance::init(pathJoin(settings.localDataDir, "profiler.log")); + Performance::init(pathJoin(settings.localDataDir, "profiler.log")); #endif // USE_PROFILER } @@ -406,7 +404,7 @@ void Dirs::initConfigDir() settings.configDir = pathJoin(VirtFs::getUserDir(), "config/settings/Mana", branding.getValue("appName", "ManaPlus")); -#elif defined WIN32 +#elif defined _WIN32 settings.configDir = getSpecialFolderLocation(CSIDL_APPDATA); if (settings.configDir.empty()) { @@ -498,10 +496,10 @@ void Dirs::initUpdatesDir() settings.updatesDir = updates.str(); } -#ifdef WIN32 +#ifdef _WIN32 if (settings.updatesDir.find(":") != std::string::npos) replaceAll(settings.updatesDir, ":", "_"); -#endif // WIN32 +#endif // _WIN32 const std::string updateDir("/" + settings.updatesDir); @@ -510,7 +508,7 @@ void Dirs::initUpdatesDir() { if (!VirtFs::mkdir(updateDir)) { -#if defined WIN32 +#if defined _WIN32 std::string newDir = pathJoin(settings.localDataDir, settings.updatesDir); if (!CreateDirectory(newDir.c_str(), nullptr) && @@ -522,7 +520,7 @@ void Dirs::initUpdatesDir() errorMessage = _("Error creating updates directory!"); client->setState(State::ERROR); } -#else // defined WIN32 +#else // defined _WIN32 logger->log("Error: %s/%s can't be made, but doesn't exist!", settings.localDataDir.c_str(), @@ -530,7 +528,7 @@ void Dirs::initUpdatesDir() // TRANSLATORS: update server initialisation error errorMessage = _("Error creating updates directory!"); client->setState(State::ERROR); -#endif // defined WIN32 +#endif // defined _WIN32 } } const std::string updateLocal = pathJoin(updateDir, "local"); |