Replies: 1 comment 1 reply
-
That's really cool, It happened to me before and had to strip down characters with string.gsub to make it a valid filename. I just checked on the JUCE File class reference and also discovered the function addTrailingSeparator() which can be very useful too for cross platform paths where the slash at the end for certain OS : https://docs.juce.com/master/classFile.html#a7093f18070f9aec99e3bfd2857761514 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I wanted to have a situation where a panel saves a sysex dump to file but offers the patch name as the filename in the save file dialog.
Often you will see solutions like:
fileToWrite = utils.saveFileWindow("Save file", File.getSpecialLocation(File.userDesktopDirectory), "*.syx", true)
But then the user must enter a filename in the prompt.
You can have a suggested file name appear in the 'save as field' with:
but this will not work with an illegal name such as "CLS 222 <Mod> 2. (for Windows at least)
So usually we would need a lot of fancy lua parsing code to sanitise the name before writing to disk, but there is a simpler solution.
This will save as CLS 222 Mod 2.syx
Hope it helps.
Source/Lua/JuceClasses/LCore.cpp
Beta Was this translation helpful? Give feedback.
All reactions