mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
Merge remote branch 'lgro/config' into config
This commit is contained in:
commit
ddb8b1e1bc
2 changed files with 23 additions and 12 deletions
|
@ -89,27 +89,37 @@ void ConfigurationManager::processPaths(Files::PathContainer& dataDirs)
|
||||||
const std::string& path = it->string();
|
const std::string& path = it->string();
|
||||||
|
|
||||||
// Check if path contains a token
|
// Check if path contains a token
|
||||||
if (!path.empty() && *path.begin() == '?' && *path.rbegin() == '?')
|
if (!path.empty() && *path.begin() == '?')
|
||||||
{
|
{
|
||||||
TokensMappingContainer::iterator tokenIt = mTokensMapping.find(path);
|
std::string::size_type pos = path.find('?', 1);
|
||||||
if (tokenIt != mTokensMapping.end())
|
if (pos != std::string::npos && pos != 0)
|
||||||
{
|
{
|
||||||
boost::filesystem::path tempPath(((mFixedPath).*(tokenIt->second))());
|
TokensMappingContainer::iterator tokenIt = mTokensMapping.find(path.substr(0, pos + 1));
|
||||||
|
if (tokenIt != mTokensMapping.end())
|
||||||
if (boost::filesystem::is_directory(tempPath))
|
|
||||||
{
|
{
|
||||||
(*it) = tempPath;
|
boost::filesystem::path tempPath(((mFixedPath).*(tokenIt->second))());
|
||||||
|
if (pos < path.length() - 1)
|
||||||
|
{
|
||||||
|
// There is something after the token, so we should
|
||||||
|
// append it to the path
|
||||||
|
tempPath /= path.substr(pos + 1, path.length() - pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (boost::filesystem::is_directory(tempPath))
|
||||||
|
{
|
||||||
|
(*it) = tempPath;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
(*it).clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Clean invalid / unknown token, it will be removed outside the loop
|
||||||
(*it).clear();
|
(*it).clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// Clean invalid / unknown token, it will be removed outside the loop
|
|
||||||
(*it).clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,7 @@ struct FixedPath
|
||||||
mGlobalPath /= suffix;
|
mGlobalPath /= suffix;
|
||||||
|
|
||||||
mLocalDataPath /= suffix;
|
mLocalDataPath /= suffix;
|
||||||
|
mUserDataPath /= suffix;
|
||||||
mGlobalDataPath /= suffix;
|
mGlobalDataPath /= suffix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue