izzyreal / mpc

mpc2000xl emulator static library
GNU General Public License v3.0
73 stars 8 forks source link

Directory names over 8 characters in length are not handled correctly on Windows #167

Closed izzyreal closed 1 year ago

izzyreal commented 1 year ago

The idea is that VMPC2000XL on Windows uses the shortname entry that is part of most people's FATs (additional to the long name users usually see in Explorer and other applications).

This is not handled correctly, however. If we create a directory named morethanmorethanmorethanmorethan in Documents/VMPC2000XL/Volumes/MPC2000XL, the moment we want to open the LOAD or SAVE screen VMPC2000XL crashes. If we create a slightly shorter named directory, like morethanmorethanmorethan, LOAD or SAVE does not crash, but we see the long file name. This is not the intended behaviour. The intended behaviour is to show the short name, i.e. MORETH~1.

Maybe we should get rid of this optional shortname parsing on Windows. Directories could always be renamed, regardless of platform. To implement this, we have to take into account that renaming morethanmorethanmorethan to MORETH~1 results in a no-op if short file names are enabled for the file system (and by default they are). Easiest is probably to first rename the directory to some UUID, and then rename it to MORETH~1.

Additionally we want the directory to be renamed to MORETHAN, if there is no conflict with other file names.

izzyreal commented 1 year ago

This may be a good time to factor out moduru::file::* in favor of std::filesystem.

izzyreal commented 1 year ago

Resolved in f369f29d35e38aa9804c182364026256558d018a