HISE Logo Forum
    • Categories
    • Register
    • Login

    FileSystem / How tdo I set USER specified root folder?

    Scheduled Pinned Locked Moved Unsolved Scripting
    10 Posts 2 Posters 61 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.
    • ChazroxC
      Chazrox
      last edited by

      I want to create a button that opens a browser and allows the USER to specify the rootFolder for a search.

      I want to change the directory variable here to user specified.

      const var rootFolder = FileSystem.getFolder(FileSystem.Desktop);
      

      Thanks in advance! 🙏

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

        @Chazrox FileSystem.fromAbsolutePath()

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        ChazroxC 1 Reply Last reply Reply Quote 1
        • ChazroxC
          Chazrox @d.healey
          last edited by Chazrox

          @d-healey Whats the best method for searching larger directories? I have a search that returns 911,xxx possible results of which my function then tries to sort by tokens, but it always hangs and crashes. Is there a safe way to do a large search like this?

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

            @Chazrox what is the larger context for this?

            Free HISE Bootcamp Full Course for beginners.
            YouTube Channel - Public HISE tutorials
            My Patreon - HISE tutorials

            ChazroxC 1 Reply Last reply Reply Quote 1
            • ChazroxC
              Chazrox @d.healey
              last edited by Chazrox

              I want to find and return all "kick" , "snare", "Hat" etc...files within a user specified folder. If I choose "documents" it will go through all folders recursively. Total files found in documents is 911,000 but my function hangs on the sorting part. My function prints "Total Files Found" but when it tries to sort "Kick", "snare" etc. it just hangs. I obviously have a huge sample library but I want it to be able to handle a sample library of the same size.

              Can I send you a snip?

              This is what im trying to get at in the end... It works perfectly with smaller queries but larger directories crash/freeze/hang.

              Screenshot 2025-10-31 at 8.35.53 PM.png

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

                @Chazrox my first thought is don't search recursively, get them to select a specific folder. But if you really want the recursive search then offloading this to a background task might solve it.

                Free HISE Bootcamp Full Course for beginners.
                YouTube Channel - Public HISE tutorials
                My Patreon - HISE tutorials

                ChazroxC 2 Replies Last reply Reply Quote 1
                • ChazroxC
                  Chazrox @d.healey
                  last edited by Chazrox

                  @d-healey im leaning towards non-recursive search. Do you have a video that can help me write the function for said "user specified folder"? I'd like to open a browser with a button and have them select the parent folder. 🙏

                  EDIT:
                  I found the video. 👍

                  Screenshot 2025-10-31 at 11.24.22 PM.png

                  1 Reply Last reply Reply Quote 0
                  • ChazroxC
                    Chazrox @d.healey
                    last edited by Chazrox

                    @d-healey Can you help with this please. Im trying to set a variable 'UserDefinedFolder' with btnBrowse1 button, then hoping to set UserDefinedFolder to the selected 'dir'. I then need 'allFiles' to be searching within the chosen folder.....which is where I think something is going wrong because from that point on its undefined.

                    Screenshot 2025-10-31 at 11.59.59 PM.png

                    var UserDefinedFolder = "";
                    var rootFolder = "";
                    
                    const var btnBrowse1 = Content.getComponent("btnBrowse1");
                    
                    inline function onbtnBrowse1Control(component, value)
                    {
                    	if (value)
                    	{
                    		FileSystem.browseForDirectory(FileSystem.Desktop, function(dir)
                    		{
                    			Console.print(dir.toString(0));
                    			UserDefinedFolder = dir.toString(0);
                    		});
                    	}
                    	
                    	Console.print(UserDefinedFolder);
                    };
                    Content.getComponent("btnBrowse1").setControlCallback(onbtnBrowse1Control);
                    
                    // Search All Files
                    //const var rootFolder = FileSystem.getFolder(FileSystem.Desktop);
                    
                    var allFiles = FileSystem.findFiles(UserDefinedFolder, "*.wav", true);
                    rootFolder = UserDefinedFolder;
                    
                    
                    d.healeyD 1 Reply Last reply Reply Quote 0
                    • d.healeyD
                      d.healey @Chazrox
                      last edited by

                      @Chazrox said in FileSystem / How tdo I set USER specified root folder?:

                      then hoping to set UserDefinedFolder to the selected 'dir'. I then need 'allFiles' to be searching within the chosen folder.....which is where I think something is going wrong because from that point on its undefined.

                      findFiles needs you to pass it a File object. You are passing a string. So instead of calling dir.toString(0), just store dir which is already a File object.

                      Free HISE Bootcamp Full Course for beginners.
                      YouTube Channel - Public HISE tutorials
                      My Patreon - HISE tutorials

                      ChazroxC 1 Reply Last reply Reply Quote 0
                      • ChazroxC
                        Chazrox @d.healey
                        last edited by

                        @d-healey I eneded up figuring that out reading thru the apis.....then everything went baaaad. lol

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

                        10

                        Online

                        2.0k

                        Users

                        12.8k

                        Topics

                        110.9k

                        Posts