HISE Logo Forum
    • Categories
    • Register
    • Login

    extractZipFile problem

    Scheduled Pinned Locked Moved General Questions
    81 Posts 5 Posters 4.0k 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.
    • LindonL
      Lindon
      last edited by Lindon

      So I'm trying to use
      File.extractZipFile

      ..and I'm running into this problem

      Failed to create target folder: C:\Program Files\Common Files\VST3\TestCompany
      
      • which I think is a file permissions issue

      Anyone know a way round this?

      -- Do I need to create the directory first? If so how do I get the directory:
      C:\Program Files\Common Files\VST3\

      ????

      or if Im on a Mac how do I get the directory:

      Macintosh HD/Library/Audio/Plug-ins/VST3

      ????

      Boggling here...

      HISE Development for hire.
      www.channelrobot.com

      LindonL 1 Reply Last reply Reply Quote 0
      • LindonL
        Lindon @Lindon
        last edited by

        @Lindon OKay more testing ...and yes I cant write to:

        C:\Program Files\Common Files\VST3\

        even after obtaining it as a Directory via a series of convoluted .getParentDirectory() calls....

        • -anyone got a solution?

        HISE Development for hire.
        www.channelrobot.com

        Matt_SFM 1 Reply Last reply Reply Quote 0
        • Matt_SFM
          Matt_SF @Lindon
          last edited by

          @Lindon I tried it and got the same error.... until I realized I've made a mistake in the function :

          f.extractZipFile(d, true, extractCB);
          

          I scripted a wrong destination folder, so obviously it returned an error.
          It's working here now (I'm currently on my mac).

          About the VST3 folder on mac, did you manage to crawl your way to it ? I noticed there's a FileSystem.Application constant, which is not in the docs.
          From there it would be easier to get to the vst3 folder.

          Develop branch
          Win10 & VS17 / Ventura & Xcode 14. 3

          LindonL 1 Reply Last reply Reply Quote 0
          • LindonL
            Lindon @Matt_SF
            last edited by

            @Matt_SF did you create (write to) another subfolder? this seems to be the problem, I can get to the Directory but its not letting me create a folder, so I get to

            C:/Program Files/Common Files/VST3/

            but trying to add /TestCompany directory fails...

            same when I try and unzip something to it, still if the extractZipFile is working...

            you are trying to extract to Macintosh HD/Library/Audio/Plug-ins/VST3/

            right?

            HISE Development for hire.
            www.channelrobot.com

            Matt_SFM 1 Reply Last reply Reply Quote 0
            • Matt_SFM
              Matt_SF @Lindon
              last edited by

              @Lindon I've only got the file, and extracted it to, the 'downloads' folder, so no subfolder.
              I'll try it now

              Develop branch
              Win10 & VS17 / Ventura & Xcode 14. 3

              LindonL 1 Reply Last reply Reply Quote 0
              • LindonL
                Lindon @Matt_SF
                last edited by

                @Matt_SF extracting to a downloads folder isn't really the same... it needs to be one of these system folders...

                HISE Development for hire.
                www.channelrobot.com

                Matt_SFM 1 Reply Last reply Reply Quote 0
                • Matt_SFM
                  Matt_SF @Lindon
                  last edited by

                  @Lindon yep successfully extracted the zip file to the VST3 folder. One thing though (I don't know if that matters) but I was lazy and got the destination folder with the FileSystem.fromAbsolutePath function.

                  Develop branch
                  Win10 & VS17 / Ventura & Xcode 14. 3

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

                    These might be useful:

                    bcf71dd9-e0e3-4150-95c9-d335b055615a-image.png

                    97af5e72-bee3-4b60-aeb1-2ed31579d0a8-image.png

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

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

                      @d-healey said in extractZipFile problem:

                      These might be useful:

                      bcf71dd9-e0e3-4150-95c9-d335b055615a-image.png

                      97af5e72-bee3-4b60-aeb1-2ed31579d0a8-image.png

                      Not sure how to use these, I guess I can check the directory has write permission, but not sure how to use the other (setExecutePermission) to set the write permissions...oh hang on theres:

                      File.setReadOnly

                      Perhaps thats it...

                      HISE Development for hire.
                      www.channelrobot.com

                      LindonL 1 Reply Last reply Reply Quote 0
                      • LindonL
                        Lindon @Lindon
                        last edited by

                        @Lindon nope cant get that to work either...

                        HISE Development for hire.
                        www.channelrobot.com

                        Matt_SFM 1 Reply Last reply Reply Quote 0
                        • Matt_SFM
                          Matt_SF @Lindon
                          last edited by Matt_SF

                          @Lindon I don't know where you ended up with this, but I'm leaving this here in case someone needs this:

                          const d = FileSystem.getFolder(FileSystem.Downloads);
                          const absFolder = FileSystem.fromAbsolutePath("/Library/Audio/Plug-Ins/VST3");
                          
                          inline function onButton1Control(component, value)
                          {
                          	if(!value)
                          		return;
                          		
                          	local f = d.getChildFile("myFile.zip");
                          	
                          	local write = absFolder.hasWriteAccess();	//should return 1	
                          	local exec = absFolder.setExecutePermission(true);	//should return 1
                          	local unzip = f.extractZipFile(absFolder, true, extractCB);
                          
                          };
                          
                          Content.getComponent("Button1").setControlCallback(onButton1Control);
                          
                          function extractCB(obj)
                          {
                          	Console.print(trace(obj));
                          };
                          

                          I don't know if this one really applies here though (shouldBeExecutable ?) :

                          File.setExecutePermission(bool shouldBeExecutable)
                          

                          Develop branch
                          Win10 & VS17 / Ventura & Xcode 14. 3

                          LindonL 2 Replies Last reply Reply Quote 0
                          • LindonL
                            Lindon @Matt_SF
                            last edited by

                            @Matt_SF - yeah - but no, heres my code:

                            var tempVSTFolder = FileSystem.fromAbsolutePath("C:/Program Files/Common Files/VST3");		
                            Console.print("temp VST is a real DIR?:" + tempVSTFolder.isDirectory());
                            Console.print(".........is VST Folder writable?:" + tempVSTFolder.hasWriteAccess());
                            		
                            var tempCompanyVSTFolder = tempVSTFolder.createDirectory("TEMPTESTCo");
                            Console.print("temp **COMPANY** VST is a real DIR?:" + tempCompanyVSTFolder.isDirectory());
                            Console.print("is Co Folder writable?:" + tempCompanyVSTFolder.hasWriteAccess());
                            var tempVSTFile = tempCompanyVSTFolder.getChildFile("temp.VST3");
                            Console.print("...does the file exist?:" + tempVSTFile.isFile());
                            

                            and heres the results I see:

                            Interface: temp VST is a real DIR?:1
                            Interface: .........is VST Folder writable?:1
                            Interface: temp **COMPANY** VST is a real DIR?:0
                            Interface: is Co Folder writable?:1
                            Interface: ...does the file exist?:0
                            

                            So none of this adds up...

                            it says "C://Program Files/Common Files/VST3 is a real directory and it has write access, but....

                            when I create the subFolder it says its NOT a real directory BUT it is writeable (so thats just plain odd right there...)

                            I try creating a file in this writable folder and it doesnt exist...

                            HISE Development for hire.
                            www.channelrobot.com

                            1 Reply Last reply Reply Quote 0
                            • LindonL
                              Lindon @Matt_SF
                              last edited by Lindon

                              @Matt_SF said in extractZipFile problem:

                              @Lindon I don't know where you ended up with this, but I'm leaving this here in case someone needs this:

                              const absFolder = FileSystem.fromAbsolutePath("/Library/Audio/Plug-Ins/VST3");
                              
                              inline function onButton1Control(component, value)
                              {
                              	if(!value)
                              		return;
                              		
                              	local absFolder = d.getChildFile("myFile.zip");
                              	
                              	local write = absFolder.hasWriteAccess();	//should return 1	
                              	local exec = absFolder.setExecutePermission(true);	//should return 1
                              	Console.print(write);
                              };
                              

                              ..and looking at this I think its not even testing the problem:

                              local absFolder = d.getChildFile("myFile.zip");
                              

                              isnt actually doing anything (unless you've declared d somewhere else...)

                              it should be:

                              local someFile = absFolder.getChildFile("myFile.zip");
                              

                              HISE Development for hire.
                              www.channelrobot.com

                              Matt_SFM 1 Reply Last reply Reply Quote 0
                              • Matt_SFM
                                Matt_SF @Lindon
                                last edited by Matt_SF

                                @Lindon ah, my bad, I cut the script I posted and this line was missing (AND I miswrote the thing when I posted it you're right !!!, but when I tried it here I got it right, otherwise I obviously wouldn't have said so).

                                const d = FileSystem.getFolder(FileSystem.Downloads);
                                

                                (I've edited it)
                                I just took a random zipFile I had in my downloads folder to unzip it in the VST3 folder.

                                Regarding the script you posted, this is my output :

                                Interface: temp VST is a real DIR?:1
                                Interface: .........is VST Folder writable?:1
                                Interface: temp **COMPANY** VST is a real DIR?:1
                                Interface: is Co Folder writable?:1
                                Interface: ...does the file exist?:0
                                

                                The "TEMPTESTCo" folder is indeed created here in the folder.
                                There is definetely something messing up the whole thing...

                                Develop branch
                                Win10 & VS17 / Ventura & Xcode 14. 3

                                LindonL 1 Reply Last reply Reply Quote 0
                                • LindonL
                                  Lindon @Matt_SF
                                  last edited by

                                  @Matt_SF -hmm yeah it looks like even yours ISNT creating temp.VST3

                                  @Christoph-Hart - I think the problem here is about access permissions, to create(or remove) anything in

                                  C://Program Files/Common Files/VST3

                                  requires administrator permission - and this is usually the state of affairs in all "normal" windows environments, I think here that the calls are being unsuccessful because they dont have this level of permission, so we need:

                                  1. the existing calls to provide some level of feedback about the error that is occurring, and not to behave as if all is well in subsequent calls...

                                  2. Some way of setting the user to Administrator for these calls...

                                  Otherwise I have no way of writing anything to this folder...and my installer really needs to do this..

                                  Of course I could be totally wrong, not -as we all know- such an unusual situation...

                                  HISE Development for hire.
                                  www.channelrobot.com

                                  Matt_SFM 1 Reply Last reply Reply Quote 0
                                  • Matt_SFM
                                    Matt_SF @Lindon
                                    last edited by Matt_SF

                                    @Lindon aaah I just remebered... for the test example you posted, I've scratched my head on this before. Actually the file isn't created unless you write something in it :

                                    var tempVSTFolder = FileSystem.fromAbsolutePath("/Library/Audio/Plug-Ins/VST3");		
                                    Console.print("temp VST is a real DIR?:" + tempVSTFolder.isDirectory());
                                    Console.print(".........is VST Folder writable?:" + tempVSTFolder.hasWriteAccess());
                                    		
                                    var tempCompanyVSTFolder = tempVSTFolder.createDirectory("TEMPTESTCo");
                                    Console.print("temp **COMPANY** VST is a real DIR?:" + tempCompanyVSTFolder.isDirectory());
                                    Console.print("is Co Folder writable?:" + tempCompanyVSTFolder.hasWriteAccess());
                                    
                                    var tempVSTFile = tempCompanyVSTFolder.getChildFile("temp.VST3");
                                    tempVSTFile.writeString("Write something in the file to create it");
                                    
                                    Console.print("...does the file exist?:" + tempVSTFile.isFile());
                                    
                                    Interface: temp VST is a real DIR?:1
                                    Interface: .........is VST Folder writable?:1
                                    Interface: temp **COMPANY** VST is a real DIR?:1
                                    Interface: is Co Folder writable?:1
                                    Interface: ...does the file exist?:1
                                    

                                    But that doesn't explain why unzipping a file doesn't work on your machine...

                                    Would this be a workaround for your issue ? Maybe create the folder, write a dummy txt file so the folder is actually created, then write the file you need in that folder ?

                                    Develop branch
                                    Win10 & VS17 / Ventura & Xcode 14. 3

                                    LindonL 1 Reply Last reply Reply Quote 0
                                    • LindonL
                                      Lindon @Matt_SF
                                      last edited by Lindon

                                      @Matt_SF - nope no change there...

                                      var tempVSTFolder = FileSystem.fromAbsolutePath("C:/Program Files/Common Files/VST3");		
                                      Console.print("temp VST is a real DIR?:" + tempVSTFolder.isDirectory());
                                      Console.print(".........is VST Folder writable?:" + tempVSTFolder.hasWriteAccess());
                                      
                                      
                                      var tempCompanyVSTFolder = tempVSTFolder.createDirectory("TEMPTESTCo");
                                      Console.print("temp **COMPANY** VST is a real DIR?:" + tempCompanyVSTFolder.isDirectory());
                                      Console.print("is Co Folder writable?:" + tempCompanyVSTFolder.hasWriteAccess());
                                      var tempVSTFile = tempCompanyVSTFolder.getChildFile("temp.txt");
                                      tempVSTFile.writeString("temp value here");
                                      
                                      Console.print("...does the file exist?:" + tempVSTFile.isFile());
                                      Console.print("is writable?:" + tempVSTFile.hasWriteAccess());
                                      

                                      still no file and no folder...

                                      HISE Development for hire.
                                      www.channelrobot.com

                                      Matt_SFM 1 Reply Last reply Reply Quote 0
                                      • Matt_SFM
                                        Matt_SF @Lindon
                                        last edited by

                                        @Lindon damn...
                                        What's weird is that, if you need admin rights to execute these kind of functions - even in HISE - you should be prompted to grant access to the system folders or not...

                                        Develop branch
                                        Win10 & VS17 / Ventura & Xcode 14. 3

                                        LindonL 1 Reply Last reply Reply Quote 0
                                        • LindonL
                                          Lindon @Matt_SF
                                          last edited by

                                          @Matt_SF said in extractZipFile problem:

                                          @Lindon damn...
                                          What's weird is that, if you need admin rights to execute these kind of functions - even in HISE - you should be prompted to grant access to the system folders or not...

                                          yeah, something's not right....

                                          HISE Development for hire.
                                          www.channelrobot.com

                                          Christoph HartC 1 Reply Last reply Reply Quote 0
                                          • Christoph HartC
                                            Christoph Hart @Lindon
                                            last edited by

                                            What happens if you start HISE as administrator (via right click)?

                                            There‘s not much you can do here on my side - either you have the permission or not.

                                            LindonL 2 Replies Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            50

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            101.9k

                                            Posts