18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-27 21:45:16 +01:00
Files
maszyna/staticFiles
maj00r 827db54430 fix(python): the files a screen opens itself are found on Linux when named in another case (#449)
#362 made the simulator find the data named in another case of its letters, through FileOnDisk(), the
script of a screen included. What the script opens itself goes past it: Image.open(), ImageFont.truetype(),
open() and the openimage() of the screens go straight to the system. The data is made on Windows, so on
Linux a screen that asks for "WS_on.png" where the disk has "ws_on.png" doesn't start at all, e.g. the left
screens of the EN57AL/AKM (WS_gotowosc.png), EN57AKL and EN71AKS (WN_off.png, M1M2_on.png and more).

abstractscreenrenderer.py, run in __main__ before any screen, now finds those files as FileCased() does:
the name given when it's on the disk, otherwise the one differing from it only in case, of the file or of
its folders, a folder listed again for a name missing at most once a second. builtins.open() (which
Image.open() goes through) and ImageFont.truetype() take the name so found, and openimage() looks for it.
A file not there yet goes into its folder as named on the disk, so a screen writing its state for the first
time doesn't make a second folder. A name with no such file is passed on as given, so a file missing fails
as before.

On Windows, which finds the names in any case itself, nothing is wrapped and nothing changes. No change to
the game data is needed.

Checked on a case-sensitive folder (a Windows folder with the case-sensitive attribute) with the scripts as
they are in the data: with the file of master the EN57AL, EN57AKL and EN71AKS screens fail to start, with
this one they start and render; plus the cases of the lookup (folders, ./, .., backslashes, a new file, a
missing one, the module run twice, a screen's global named like the module's own).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 19:28:54 +01:00
..
2025-04-15 01:50:48 +02:00
2025-04-15 01:50:48 +02:00