18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-20 08:04:57 +01:00

fix(files): models named in another case are found on Linux

The manager of the models looked for the file with FileExists of a single
name, a plain check again since the banks keep the names asked for, so a
model named in another case (models/przejazdy/plyty3_L,
dynamic/pkp/st44_v2/main/2M62-0685-A) was reported missing before
TModel3d::LoadFromFile() could open it as it's named on the disk.

find_on_disk() finds the file in any case and gives back the name asked
for, the key of the bank.
This commit is contained in:
maj00r
2026-11-13 17:49:18 +01:00
parent f9b7e9174c
commit d76e6368b0

View File

@@ -137,15 +137,19 @@ TModelsManager::find_in_databank( std::string const &Name ) {
}
// checks whether specified file exists. returns name of the located file, or empty string.
// the file is found in any case, as the scenery made on Windows names it, but the name is given back as asked for: it's the key of
// the bank, and TModel3d::LoadFromFile() opens the file as it's named on the disk
std::string
TModelsManager::find_on_disk( std::string const &Name ) {
std::vector<std::string> extensions { { ".e3d" }, { ".t3d" } };
for( auto const &extension : extensions ) {
auto lookup = FileExists(Name + extension) ? Name : FileExists(paths::models + Name + extension) ? paths::models + Name : "";
if( false == lookup.empty() ) {
return lookup;
if( false == FileCased( Name + extension ).empty() ) {
return Name;
}
if( false == FileCased( paths::models + Name + extension ).empty() ) {
return paths::models + Name;
}
}