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

fix(files): the banks keep the names asked for, only the opening takes the case of the disk

The textures, materials and sounds are kept by the names they're asked for.
Given back as named on the disk, a file in another case missed the bank and
was loaded again on every request.

- FileExists with names and extensions finds the file in any case but gives
  back the name asked for; FileOnDisk gives the file to open, used where
  textures, sounds and scripts are opened
- FileExists of a single name is a plain check again, the places checking
  it and opening the same name stay as they were
- the texture format is told by the extension asked for again
- a folder changed shortly before it was read is read again for a name
  missing from it, the time of a change being as coarse as the clock of the
  file system; a listing cut short isn't kept
This commit is contained in:
maj00r
2026-11-13 15:47:52 +01:00
parent d0a3694657
commit afbc84c6bc
6 changed files with 55 additions and 47 deletions

View File

@@ -225,8 +225,11 @@ bool FileExists(std::string const &Filename);
// the file as it's named on the disk when only the case of its name or of its folders differs, as in the sceneries made on Windows;
// empty when there's none. on Windows, finding the names in any case itself, the file given or none
std::string FileCased(std::filesystem::path const &Filename);
// the file to open: as it's named on the disk, the name given when there's none
std::string FileOnDisk(std::string const &Filename);
// the first name with one of the extensions which has a file, in the order given, as the file is named on the disk
// the first name with one of the extensions which has a file in any case, in the order given; given back as named here, the file
// is opened by FileOnDisk()
std::pair<std::string, std::string> FileExists(std::vector<std::string> const &Names, std::vector<std::string> const &Extensions);
// returns time of last modification for specified file