FileSystem Question - Make a directory that doesn't exist

  • Hey all,

    I'm running into an issue where if I want to save a file (like a user preset) into a new folder, there's no way to do it unless the folder already exists on the computer. Am I missing something? Here's a simple example:

    var file = FileSystem.getFolder(FileSystem.UserPresets).getChildFile("Factory/Utility/test.preset");

    If Factory/Utilitydoesn't exist, the function won't do anything.

  • It looks like we just need some additional JUCE File Class functions in the Scripting API. createDirectory() would be really useful!

  • @Lunacy-Audio I'd love to be able to do this too, at the moment my plan is to either do a post install script to create the folders (which I've yet to learn), or have the user save those presets into the top level of User Presets, which will get messy!

  • The installer is a good temporary solution and isn't too hard.

    I just added createDirectory() to the Scripting API. It's a pretty simple call, but I'm not sure if it's the cleanest solution, so I'll need to check with Christoph before I pull request. Looks something like this:

    var newFolder = FileSystem.getFolder(FileSystem.UserPresets).createDirectory("NewFolder");

Log in to reply