Improve path conversions

openmw-38
scrawl 9 years ago
parent 84aceedfa2
commit d894d54e41

@ -385,8 +385,8 @@ bool Launcher::MainDialog::setupGraphicsSettings()
// the filenames should be in the CfgMgr component.
// Create the settings manager and load default settings file
const std::string localDefault = mCfgMgr.getLocalPath().string() + "settings-default.cfg";
const std::string globalDefault = mCfgMgr.getGlobalPath().string() + "settings-default.cfg";
const std::string localDefault = (mCfgMgr.getLocalPath() / "settings-default.cfg").string();
const std::string globalDefault = (mCfgMgr.getGlobalPath() / "settings-default.cfg").string();
std::string defaultPath;
// Prefer the settings-default.cfg in the current directory.
@ -414,7 +414,7 @@ bool Launcher::MainDialog::setupGraphicsSettings()
}
// Load user settings if they exist
const std::string userPath = mCfgMgr.getUserConfigPath().string() + "settings.cfg";
const std::string userPath = (mCfgMgr.getUserConfigPath() / "settings.cfg").string();
// User settings are not required to exist, so if they don't we're done.
if (!boost::filesystem::exists(userPath)) return true;
@ -498,7 +498,7 @@ bool Launcher::MainDialog::writeSettings()
file.close();
// Graphics settings
const std::string settingsPath = mCfgMgr.getUserConfigPath().string() + "settings.cfg";
const std::string settingsPath = (mCfgMgr.getUserConfigPath() / "settings.cfg").string();
try {
mEngineSettings.saveUser(settingsPath);
}

@ -298,8 +298,8 @@ void OMW::Engine::setSkipMenu (bool skipMenu, bool newGame)
std::string OMW::Engine::loadSettings (Settings::Manager & settings)
{
// Create the settings manager and load default settings file
const std::string localdefault = mCfgMgr.getLocalPath().string() + "settings-default.cfg";
const std::string globaldefault = mCfgMgr.getGlobalPath().string() + "settings-default.cfg";
const std::string localdefault = (mCfgMgr.getLocalPath() / "settings-default.cfg").string();
const std::string globaldefault = (mCfgMgr.getGlobalPath() / "settings-default.cfg").string();
// prefer local
if (boost::filesystem::exists(localdefault))
@ -310,7 +310,7 @@ std::string OMW::Engine::loadSettings (Settings::Manager & settings)
throw std::runtime_error ("No default settings file found! Make sure the file \"settings-default.cfg\" was properly installed.");
// load user settings if they exist
const std::string settingspath = mCfgMgr.getUserConfigPath().string() + "settings.cfg";
const std::string settingspath = (mCfgMgr.getUserConfigPath() / "settings.cfg").string();
if (boost::filesystem::exists(settingspath))
settings.loadUser(settingspath);

Loading…
Cancel
Save