File::createLegalFileName is too conservative

I did bring this up 17 years ago, but I think it’s worth a revisit: File::createLegalFileName and comma

File::createLegalFileName is too conservative and restricts characters users want to use in filenames. For example, using # symbol for sharp is very common in sample packs. Users get frustrated when they can’t name their samples properly using juce based software.

I can understand wanting the set of characters that are available on all platforms, and Windows is more restrictive, so I think just the following characters should be disallowed:

image

1 Like

Ooh, this is one of my pet peeves, having spent hours and hours debugging system bugs, only to find that someone used “thisfilename # has a hash in it.txt”, which … as you can imagine … completely broke things through multiple locations in the pipeline.

If you do decide to allow this yucky behaviour on the part of your users, and after all why wouldn’t you, please consider enforcing the guidelines for this kind of mischief as described here:

In short - escape the hash! In fact, escape all the naughty chars! And, if you do so, nothing has to change in JUCE …