jack-cli-cd-ripper / jack

Jack command-line CD ripper
GNU General Public License v2.0
14 stars 5 forks source link

python3-mb: adding regex support to unusable_chars/replacement_chars is an ugly hack #21

Closed pimzand closed 2 years ago

pimzand commented 4 years ago

It should either get its own configuration, or be documented properly

pimzand commented 2 years ago

Well, at least the purpose of the code is commented now in the source.

I created it to prevent directory names that end with a dot, like "R.E.M.". Filenames or directory names that end with a dot are illegal in Windows. Either the dot gets lost (when copied to a FAT filesystem), or the directory name is garbled (when shared by Samba).

My fix is to append a zero-width space. unusable character: r"/.$/" replacement character: ".\u200b"

zzarne commented 2 years ago

I really like this not-ugly-but-very-elegant hack ;-)

A separate option would clutter them even more. Yes, "unusable_chars" is no longer entirely fitting, but as long as it's documented, I'm fine with it. Better than renaming the option.

Close?

pimzand commented 2 years ago

I could have left the rule to enclose the regex pattern in slashes out, treating every multi-character "character" as a regex pattern. But I'm fine too with it, especially because you are. Closing.