mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-20 13:54:58 +01:00
fix(files): terrain files named in another case are found on Linux
The terrain directive names .txtf/.btf files in lowercase, as the parser gives every token. The name is now taken as it is on disk, from the text file first, so the binary file is made next to the text and the editor's references and layers keep one name.
This commit is contained in:
@@ -692,6 +692,19 @@ std::string FileOnDisk(std::string const &Filename)
|
||||
return cased.empty() ? Filename : cased;
|
||||
}
|
||||
|
||||
std::string FileStemOnDisk(std::string const &Folder, std::string const &Name, std::vector<std::string> const &Extensions)
|
||||
{
|
||||
for (auto const &extension : Extensions)
|
||||
{
|
||||
auto const cased{FileCased(Folder + Name + extension)};
|
||||
if (cased.size() > Folder.size() + extension.size() && cased.starts_with(Folder) && cased.ends_with(extension))
|
||||
{
|
||||
return cased.substr(Folder.size(), cased.size() - Folder.size() - extension.size());
|
||||
}
|
||||
}
|
||||
return Name;
|
||||
}
|
||||
|
||||
std::pair<std::string, std::string> FileExists(std::vector<std::string> const &Names, std::vector<std::string> const &Extensions)
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user