Setting setting dir before genetation maps.

This commit is contained in:
Vladimir Byko-Ianko 2017-12-05 11:18:48 +03:00 committed by Ilya Zverev
parent ddfffef9cc
commit c8fe8e352a
4 changed files with 7 additions and 4 deletions

View file

@ -141,7 +141,10 @@ int main(int argc, char ** argv)
Platform & pl = GetPlatform();
if (!FLAGS_user_resource_path.empty())
{
pl.SetResourceDir(FLAGS_user_resource_path);
pl.SetSettingsDir(FLAGS_user_resource_path);
}
std::string const path =
FLAGS_data_path.empty() ? pl.WritableDir() : my::AddSlashIfNeeded(FLAGS_data_path);

View file

@ -97,7 +97,7 @@ bool Platform::RmDirRecursively(string const & dirName)
return res;
}
void Platform::SetSettingsDirForTests(string const & path)
void Platform::SetSettingsDir(string const & path)
{
m_settingsDir = my::AddSlashIfNeeded(path);
}

View file

@ -163,7 +163,7 @@ public:
/// as WritableDir, but on some platforms it's different
string SettingsDir() const { return m_settingsDir; }
/// Set settings dir — use for testing.
void SetSettingsDirForTests(string const & path);
void SetSettingsDir(string const & path);
/// @return full path to file in the settings directory
string SettingsPathForFile(string const & file) const { return SettingsDir() + file; }

View file

@ -19,7 +19,7 @@ WritableDirChanger::WritableDirChanger(string const & testDir, SettingsDirPolicy
TEST_EQUAL(Platform::ERR_OK, platform.MkDir(m_testDirFullPath), ());
platform.SetWritableDirForTests(m_testDirFullPath);
if (m_settingsDirPolicy == SettingsDirPolicy::UseWritableDir)
platform.SetSettingsDirForTests(m_testDirFullPath);
platform.SetSettingsDir(m_testDirFullPath);
settings::Clear();
}
@ -30,6 +30,6 @@ WritableDirChanger::~WritableDirChanger()
string const writableDirForTest = platform.WritableDir();
platform.SetWritableDirForTests(m_writableDirBeforeTest);
if (m_settingsDirPolicy == SettingsDirPolicy::UseWritableDir)
platform.SetSettingsDirForTests(m_writableDirBeforeTest);
platform.SetSettingsDir(m_writableDirBeforeTest);
platform.RmDirRecursively(writableDirForTest);
}