mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
fix crash on exit when no user settings exist
This commit is contained in:
parent
c2a82c3d89
commit
5accca385c
3 changed files with 6 additions and 11 deletions
|
@ -315,7 +315,7 @@ void OMW::Engine::go()
|
|||
boost::filesystem::create_directories(configPath);
|
||||
}
|
||||
|
||||
// Create the settings manager and load default and user settings file
|
||||
// Create the settings manager and load default settings file
|
||||
Settings::Manager settings;
|
||||
const std::string localdefault = mCfgMgr.getLocalPath().string() + "/settings-default.cfg";
|
||||
const std::string globaldefault = mCfgMgr.getGlobalPath().string() + "/settings-default.cfg";
|
||||
|
@ -326,11 +326,14 @@ void OMW::Engine::go()
|
|||
else if (boost::filesystem::exists(globaldefault))
|
||||
settings.loadDefault(globaldefault);
|
||||
|
||||
// load user settings if they exist, otherwise just load the default settings as user settings
|
||||
const std::string settingspath = mCfgMgr.getUserPath().string() + "/settings.cfg";
|
||||
if (boost::filesystem::exists(settingspath))
|
||||
settings.loadUser(settingspath);
|
||||
else
|
||||
settings.copyDefaultToUserSettings();
|
||||
else if (boost::filesystem::exists(localdefault))
|
||||
settings.loadUser(localdefault);
|
||||
else if (boost::filesystem::exists(globaldefault))
|
||||
settings.loadUser(globaldefault);
|
||||
|
||||
mOgre->configure(!boost::filesystem::is_regular_file(mCfgMgr.getOgreConfigPath()),
|
||||
mCfgMgr.getOgreConfigPath().string(),
|
||||
|
|
|
@ -22,11 +22,6 @@ void Manager::loadDefault (const std::string& file)
|
|||
mDefaultFile.load(file);
|
||||
}
|
||||
|
||||
void Manager::copyDefaultToUserSettings ()
|
||||
{
|
||||
mFile = mDefaultFile;
|
||||
}
|
||||
|
||||
void Manager::saveUser(const std::string& file)
|
||||
{
|
||||
std::fstream fout(file.c_str(), std::ios::out);
|
||||
|
|
|
@ -27,9 +27,6 @@ namespace Settings
|
|||
void loadDefault (const std::string& file);
|
||||
///< load file as the default settings (can be overridden by user settings)
|
||||
|
||||
void copyDefaultToUserSettings ();
|
||||
///< copy the default settings to the user settings (useful when there are no user settings yet)
|
||||
|
||||
void loadUser (const std::string& file);
|
||||
///< load file as user settings
|
||||
|
||||
|
|
Loading…
Reference in a new issue