Datadir in command line didn't work with config.

Values from config file overwrote datadir
dev-ui
erihel 2013-07-16 16:00:06 +02:00
parent 3e8568bda4
commit b5e87aa91f
2 changed files with 8 additions and 3 deletions

View File

@ -110,6 +110,7 @@ CApplication::CApplication()
m_exitCode = 0;
m_active = false;
m_debugModes = 0;
m_customDataPath = false;
m_windowTitle = "COLOBOT";
@ -344,6 +345,7 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
case OPT_DATADIR:
{
m_dataPath = optarg;
m_customDataPath = true;
GetLogger()->Info("Using custom data dir: '%s'\n", m_dataPath.c_str());
break;
}
@ -404,7 +406,7 @@ bool CApplication::Create()
}
else
{
if (GetProfile().GetLocalProfileString("Resources", "Data", path))
if (!m_customDataPath && GetProfile().GetLocalProfileString("Resources", "Data", path))
m_dataPath = path;
}
@ -440,7 +442,7 @@ bool CApplication::Create()
GetProfile().SetLocalProfileString("Resources", "Music", GetDataSubdirPath(DIR_MUSIC));
}
if (GetProfile().GetLocalProfileString("Resources", "Sound", path))
if (!m_customDataPath && GetProfile().GetLocalProfileString("Resources", "Sound", path))
{
m_sound->CacheAll(path);
}
@ -449,7 +451,7 @@ bool CApplication::Create()
m_sound->CacheAll(GetDataSubdirPath(DIR_SOUND));
}
if (GetProfile().GetLocalProfileString("Resources", "Music", path))
if (!m_customDataPath && GetProfile().GetLocalProfileString("Resources", "Music", path))
{
m_sound->AddMusicFiles(path);
}

View File

@ -480,6 +480,9 @@ protected:
//! Path to directory with data files
std::string m_dataPath;
//! True if datadir was passed in command line
bool m_customDataPath;
//! Path to directory with language files
std::string m_langPath;