FR: removeInvalidFileCharacters() for String

just made a logger that uses __DATE__ and __TIME__ in its file name and juce refused to create the files. gladly I have github copilot which suggested me to use removeCharacters(“:”) on the string to make it a valid file name on windows.

  1. i wouldn’t have thought of that on my own.
    2.i don’t feel very safe about this solution. it might be specific to my exact machine.

that’s why I’d like to suggest a new function for juce::String that returns the same string but with valid file characters only

I think the following functions within the File class will do what you want:

static String createLegalFileName (const String& fileNameToFix);

static String createLegalPathName (const String& pathNameToFix);
2 Likes

ooh, that’s why i didn’t find it. awesome, thx

1 Like