Zingabopp / BeatSync

Beat Saber plugin to automatically download beatmaps.
Other
247 stars 22 forks source link

Invalid charaters in file names #17

Closed Johni0702 closed 4 years ago

Johni0702 commented 4 years ago

BeatSync removes invalid characters (as reported by Path.GetInvalidFileNameChars) from file names: https://github.com/Zingabopp/BeatSync/blob/b9b7e9a0bdf82f9fc79ee242c39543cb23a6f155/BeatSyncLib/Utilities/Util.cs#L248

However, it appears like the set of characters reported on Linux is different than the one reported on Windows (which makes sense), so BeatSync will create song folders with names including e.g. ", |, : and * (these are just the ones I noticed, not sure which ones exactly are the problematic ones and there are most certainly more). This is all fine until one tries to start BeatSaber (via wine, so windows file name restrictions apply) where SongCore will then trigger an exception somewhere in the directory enumeration code and therefore end up loading 0 songs total.

I've got no idea how to best solve this. The simplest fix would probably be to just never use the song name in the folder name on Linux (if I understand correctly, that's just there for humans looking at that folder, and tbh I've never had the need to do that till today). Or restricting them to [a-zA-Z0-9], which should still give good results for a significant chunk of songs.

Zingabopp commented 4 years ago

What I'll probably do is just make my own array of invalid characters with ones from both.