HISE Logo Forum
    • Categories
    • Register
    • Login

    FileSystem Question - Make a directory that doesn't exist

    Scheduled Pinned Locked Moved Scripting
    12 Posts 6 Posters 502 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Casey KolbC
      Casey Kolb
      last edited by

      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");
      Engine.saveUserPreset(file);
      

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

      Casey Kolb
      Founder & CEO of Lunacy Audio
      Composer | Producer | Software Developer

      1 Reply Last reply Reply Quote 0
      • Casey KolbC
        Casey Kolb
        last edited by

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

        Casey Kolb
        Founder & CEO of Lunacy Audio
        Composer | Producer | Software Developer

        DanHD 1 Reply Last reply Reply Quote 0
        • DanHD
          DanH @Casey Kolb
          last edited by

          @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!

          DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
          https://dhplugins.com/ | https://dcbreaks.com/
          London, UK

          1 Reply Last reply Reply Quote 0
          • Casey KolbC
            Casey Kolb
            last edited by Casey Kolb

            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");
            

            Casey Kolb
            Founder & CEO of Lunacy Audio
            Composer | Producer | Software Developer

            d.healeyD 1 Reply Last reply Reply Quote 1
            • d.healeyD
              d.healey @Casey Kolb
              last edited by

              @Lunacy-Audio said in FileSystem Question - Make a directory that doesn't exist:

              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");
              

              Did you make a pull request for this? What about a createFile function? (thinking for text/json files).

              Libre Wave - Freedom respecting instruments and effects
              My Patreon - HISE tutorials
              YouTube Channel - Public HISE tutorials

              LindonL Casey KolbC 2 Replies Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart
                last edited by

                No need for createFile() - it‘s automatically created if you write a string or object

                d.healeyD 1 Reply Last reply Reply Quote 2
                • LindonL
                  Lindon @d.healey
                  last edited by

                  @d-healey said in FileSystem Question - Make a directory that doesn't exist:

                  Did you make a pull request for this? What about a createFile function? (thinking for text/json files).

                  and this:

                  Link Preview Image
                  FileSystem - wheres "CreateFile"?

                  OK so I want to use the file system , and its nice blowfish encryption to store user credentials - but of course the first time in there are no credentials, ...

                  favicon

                  Forum (forum.hise.audio)

                  HISE Development for hire.
                  www.channelrobot.com

                  1 Reply Last reply Reply Quote 0
                  • Casey KolbC
                    Casey Kolb @d.healey
                    last edited by

                    @d-healey Just pull requested createDirectory!

                    Casey Kolb
                    Founder & CEO of Lunacy Audio
                    Composer | Producer | Software Developer

                    1 Reply Last reply Reply Quote 1
                    • d.healeyD
                      d.healey @Christoph Hart
                      last edited by d.healey

                      @Christoph-Hart said in FileSystem Question - Make a directory that doesn't exist:

                      No need for createFile() - it‘s automatically created if you write a string or object

                      I found a use case. When downloading a file, for an image cache for example, it's desirable to put these in a sub-folder.

                      @Lunacy-Audio said in FileSystem Question - Make a directory that doesn't exist:

                      @d-healey Just pull requested createDirectory!

                      And I just figured out how to merge your changes into my fork :D

                      Libre Wave - Freedom respecting instruments and effects
                      My Patreon - HISE tutorials
                      YouTube Channel - Public HISE tutorials

                      Dan KorneffD 1 Reply Last reply Reply Quote 1
                      • Dan KorneffD
                        Dan Korneff @d.healey
                        last edited by

                        @d-healey said in FileSystem Question - Make a directory that doesn't exist:

                        And I just figured out how to merge your changes into my fork

                        Please share your experience. I'll need to merge with my fork soon.

                        Dan Korneff - Producer / Mixer / Audio Nerd

                        d.healeyD 1 Reply Last reply Reply Quote 0
                        • d.healeyD
                          d.healey @Dan Korneff
                          last edited by d.healey

                          @dustbro Add Lunacy Audio's fork as a remote repo, then pull in and merge his scriptnode-tweaks branch.

                          Actually this looks like a better way to just pull the pull request directly - https://stackoverflow.com/questions/54033842/how-to-pull-a-pull-request-from-upstream-in-github

                          Libre Wave - Freedom respecting instruments and effects
                          My Patreon - HISE tutorials
                          YouTube Channel - Public HISE tutorials

                          Casey KolbC 1 Reply Last reply Reply Quote 0
                          • Casey KolbC
                            Casey Kolb @d.healey
                            last edited by

                            @d-healey @dustbro Forgive me, my Git fork is an absolute mess :face_screaming_in_fear:

                            Casey Kolb
                            Founder & CEO of Lunacy Audio
                            Composer | Producer | Software Developer

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post

                            51

                            Online

                            1.7k

                            Users

                            11.7k

                            Topics

                            102.2k

                            Posts