HISE Logo Forum
    • Categories
    • Register
    • Login

    FileSystem browseForDirectory + Server.downloadFile

    Scheduled Pinned Locked Moved General Questions
    18 Posts 2 Posters 415 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.
    • DanHD
      DanH
      last edited by

      I'm trying to make a button that asks the user where they would like to download a file to, and then trigger the download. Do I need two different steps / functions for this? This is where I'm at - I can't figure where I'd put the browsforDirectory function inside here.... (or how to reference it without having a previous step to the whole process):

      const downloadsFolder = FileSystem.getFolder(FileSystem.Downloads);
      
      inline function startDownloadOSX()
      {
      Server.setBaseURL("https://myserver etc");
      	 
      	 local f = downloadsFolder.getChildFile("INSTALLER.pkg");
      	 
      	download = Server.downloadFile(urlOSX, {}, f, downloadCallback);
      	 
      }
      

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

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

        Here's something to get you started. Notice you only need one download function for all operating systems. Don't repeat yourself ;)

        HiseSnippet 1070.3ocsVssaaaCFlxIpXxaqXEXO.D9hBY.OW6sttgEDLWeZvXI1FQoMcWkwHQYSDIRCRZ2YD32s8H02fseRIYqjZj0ZfoKr0+Q98ejZpTDRUJgD43c45ETjyW4Frlqm2aNgwQi5ibdp64DklJwYr5tdAQonQHGmi9MCCGuiQ1mO7qcIIDdHcGKD5sBVH8LVJSui6zN+NKIYHIhdIKsj1urynPAumHQrDvyQtsPKHg2RlQGSLpUwE47jAQLsPFnIZpBzoqHZcvbw64Y5+VlhcSB0PzFE.NJiMp2bVRzzhXUgPNGOcWjeTVj+stmyhXa4uKC7MVA3cVTNG3T4wfT6OCH4TBRGmAom4FDJYKz6jXvyW5NhCEjXBjpKCkLcQU9vQt8DfFbcyTxszgRfXqE9upUqFX3m5mTsJjtUZbD.1DAIRMTjDAE5SwCYIzf0PUOs4LpNiseIl8Krv3DIc1VWbhkZoLA3y3ILNEGujGpYBNVv6tTqE71FvIEI9ghzEBN.yF3Ujjkz5UuqpGKF6mS4AjV5A7YfmLPYRfec7omhqMI3c0.M77fyBmQe8at3rZm.7nIJZIQWMZb+IWEjKFDnzDotHD7gPvaS0MfjhjFbN8JflesbPWqdSkguE58HII2.8l9OLlpum39AGW067p5kGQJnO4OnpwhqXbHE5WKflPC03rLdsF3BF54TbDUoYbh0mwEJTbJ9RpBPrpbZqDKKOuRUvajh2qnCEx9LIb.B4Z+GzFTx2QLoMWach00LUeZLDAQVY3m+bL7eSf6VuU2ZQtIdAT4JpzjA6RTTnR3WatVuP8Ku3EoqUVgXpNrVcaABdVQj3Xn5YbqodXlVLv2u1nwAW95yNavEMWb6LiAV88vY+WDDfo4mYAGq0PKQC7cafXqw1d1hhY8Srdv5mMY+uw59MUsuroTm7XglNg6a6XqtoJ9ghhi2qr7tjDXZZehMqCkOlg97ko2XJM6lWLJB6Kt+Rnm7osDJLqgujhB9HNSOYAMm11JDk89GuxBkOw.u8lQ8IZhYKVNOPuETolYfiSe5J3ZfrcZdt8opa0hEVcyGy.HqsReZ9FurwJDKxXP9LF5u1dWweOqy5sDc9yNJxJ5H9TnimpMqBYpyEofeIRPMmJnOd0JrTWDsLgnu+ldyUZ4BfL+8VuZVgxUL85xW48Yr9u0it9+SEhOycJSGNe+XrxdvHTS9+.i4WZ90tChigQ9c.7X2gu6Pug7+33uPrD1.N6bhVxfdA2wKSCfuUHjBmNmCq8AdPw1Xpktkg1jABn7HKw+.O4BaancxE1tPHJkDJEWGlMuYtV9Krb.LwseEhG74P.MtMxNCB141pYKTJ7EBWGFZB+uCFU1uMe+AXyOb.17xCvle7.r4UGfM+zAXyO+n1X93rWuTKRyFG.FSGXWF43LfSfNKaWH5ek4bPTJ
        

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

        DanHD 1 Reply Last reply Reply Quote 2
        • DanHD
          DanH @d.healey
          last edited by DanH

          @d-healey Thanks Dave :) I'd prefer to make an app like you have which unpacks the samples to the desired location, but I feel that writing the Link file in AppData directory is going to lead to a bunch of permissions issues on OSX.

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

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

            @DanH There are no permission issues writing to appdata because that's a user controller folder.

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

            DanHD 1 Reply Last reply Reply Quote 0
            • DanHD
              DanH @d.healey
              last edited by DanH

              @d-healey sure but this would be a separate app.... I'd rather not have the user open the plugin in their DAW and then have to wait for the samples to download before being able to use their DAW for anything else. I thought about making the app the same name as the plugin so it uses the same AppData folder but I'm unsure if this will cause some other issues

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

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

                @DanH I think you might run into issues with two apps with the same name. You could do what I did, I use one app for both purposes but the download stuff is only active when it's running as a standalone.

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

                DanHD 1 Reply Last reply Reply Quote 0
                • DanHD
                  DanH @d.healey
                  last edited by

                  @d-healey so you supply the plugin and the standalone? and use the standalone for the server stuff?

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

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

                    @DanH Correct. You can use Engine.isPlugin() to determine if your app is running as a plugin or as standalone and disable/enable stuff accordingly.

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

                    DanHD 2 Replies Last reply Reply Quote 0
                    • DanHD
                      DanH @d.healey
                      last edited by

                      @d-healey ok, but then I guess my idea of making a separate app by the same name might actually work then. Will give it some thought, thanks

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

                      1 Reply Last reply Reply Quote 0
                      • DanHD
                        DanH @d.healey
                        last edited by

                        @d-healey so your app downloads and unpacks several zips, and updates the link file, all with one button?

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

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

                          @DanH Yes essentially, but mine uses expansions so there can be multiple link files.

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

                          DanHD 1 Reply Last reply Reply Quote 0
                          • DanHD
                            DanH @d.healey
                            last edited by

                            @d-healey yes I'm just looking through the code in your repo.

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

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

                              If you want to integrate my system into your app send me a message and we can discuss licensing.

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

                              DanHD 1 Reply Last reply Reply Quote 0
                              • DanHD
                                DanH @d.healey
                                last edited by

                                @d-healey GPL ;)

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

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

                                  @DanH Even better, take all you want.

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

                                  DanHD 1 Reply Last reply Reply Quote 0
                                  • DanHD
                                    DanH @d.healey
                                    last edited by DanH

                                    @d-healey :)

                                    Just going back to the snippet you shared with me earlier, in the download function f needs to be defined as a file but this file will be different for each OS so.... how can I define it as such? Another if statement?

                                    inline function startDownload()
                                    {	
                                    	Engine.showYesNoWindow("Select Folder", "Select the destination folder", function(response)
                                    	{
                                    		if (response)
                                    		{
                                    			FileSystem.browseForDirectory(downloadsFolder, function(dir)
                                    			{
                                    				if (isDefined(dir) && dir.isDirectory())
                                    				{
                                    					Server.setBaseURL("https://myserver etc");
                                    
                                    					var f = dir.getChildFile("MAC-INSTALLER.pkg"); // HERE
                                    						 
                                    					download = Server.downloadFile(url, {}, f, downloadCallback);					
                                    				}		
                                    			});
                                    		}
                                    	});
                                    

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

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

                                      @DanH Look at the part where I set the URL based on the OS. You can do the same thing for the file name.

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

                                      DanHD 1 Reply Last reply Reply Quote 0
                                      • DanHD
                                        DanH @d.healey
                                        last edited by

                                        @d-healey Yes, think I've got it working :crossed_fingers:

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

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

                                        47

                                        Online

                                        1.7k

                                        Users

                                        11.7k

                                        Topics

                                        101.9k

                                        Posts