GEMDOS HD does that because most TOS programs wouldn't work with more dots in the file name, and '+' is valid file name character in TOS. It uses something in place of invalid characters so that those modified file names can be better mapped back to the host file names.
However, atari-convert-dir.py has slightly different purpose, it tries to model what Atari TOS does for file names instead of providing two-way atari<->host file name mapping.
Use-case 1: Atari program works with long file names under MiNT, how those file names should be mapped so that this same program works under normal TOS and its 8+3 file system, although it's asking TOS for files with their long names (ScummVM and OpenTTD Atari ports are examples where this is useful)?
Use-case 2: Some Atari disks contain "invalid" TOS filename characters, potentially as some kind of primitive copy protection method. It should still be possible to extract such files from a zip and create a correctly working floppy disk image out of it. I.e. just removing invalid characters isn't necessarily the correct thing to do.
Therefore, before changing anything, I'd like results from an Atari test program that demonstrates what happens:
* If Atari program tries to search (Fsfirst) a pattern with multiple dots in its name. What TOS will actually search from the disk, if anything?
* What if Atari program gives such name for opening (Fopen/Fcreate) a file, what file name TOS actually opens from the disk?
After that, it would be good to check that the modified names can be stored to the disk image with Mtools utilities, or using Hatari to copy them from GEMDOS HD. If there's an issue with Hatari GEMDOS HD emulation, that could be updated.
PS. while using list comprehension to count dots works:
Code: Select all
+ dotpositions = [pos for pos, char in enumerate(name) if char == "."]
+ name = name.replace(".", "", len(dotpositions) - 1)
+ return name
Python has also specific string method for counting chars, which is easier to read:
Code: Select all
+ dots = name.count('.')
+ return name.replace('.', '', dots-1)