mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
avoid forbidden chars in path
This commit is contained in:
parent
b22a9ff2d0
commit
485af4b4b5
@ -212,7 +212,11 @@ void CPlayerInterface::performAutosave()
|
||||
prefix = settings["general"]["savePrefix"].String();
|
||||
if(prefix.empty())
|
||||
{
|
||||
prefix = cb->getMapHeader()->name.substr(0, 15) + "_" + cb->getStartInfo()->startTimeIso8601 + "/";
|
||||
std::string name = cb->getMapHeader()->name.substr(0, 15);
|
||||
std::string forbiddenChars("\\/:?\"<>| ");
|
||||
std::replace_if(name.begin(), name.end(), [&](char c) { return std::string::npos != forbiddenChars.find(c); }, '_' );
|
||||
|
||||
prefix = name + "_" + cb->getStartInfo()->startTimeIso8601 + "/";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@ namespace vstd
|
||||
{
|
||||
std::tm tm = *std::localtime(&dt);
|
||||
std::stringstream s;
|
||||
s.imbue(std::locale(""));
|
||||
s << std::put_time(&tm, "%Y%m%dT%H%M%S");
|
||||
return s.str();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user