mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-08 11:34:19 +01:00
fix(app): a scenery file named in another case than given is found, a scenario that can't be opened goes back to the launcher
The command line gives the name of the scenery lowercased, and the sceneries made on Windows name their files and includes in any case: on a case-sensitive filesystem they weren't found. FileCased() finds the file whose name differs only in case; the parser and the scenario loader use it. A scenario that can't be opened logs the reason and goes back to the launcher instead of ending with an exception.
This commit is contained in:
@@ -63,6 +63,15 @@ cParser::cParser(std::string const &Stream, buffertype const Type, std::string P
|
||||
// the file is read in one go, tokens are then extracted straight from the memory
|
||||
std::ifstream file(Path, std::ios_base::binary);
|
||||
if (file.fail())
|
||||
{
|
||||
// named in another case than it's on the disk
|
||||
if (auto const cased{FileCased(Path)}; false == cased.empty())
|
||||
{
|
||||
file.clear();
|
||||
file.open(cased, std::ios_base::binary);
|
||||
}
|
||||
}
|
||||
if (file.fail())
|
||||
{
|
||||
mFailBit = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user