Native unzip on Windows

I see. At this phase I’m not worried about security/permission issues, i.e., I’m assuming the user has the privileges to replace their app. But since that doesn’t mean they will have the privileges to access all system services, it looks like an external app is required. Pity.

Who ships an OS without the proper zip tools installed natively?!?

Thanks to all for your input and help.

https://social.technet.microsoft.com/Forums/systemcenter/en-US/6f8129d0-3cbd-4e59-9d3b-a6376b9ff3cf/cscript-vbs-deployment-fails-due-to-permission-issue

http://support.microsoft.com/KB/248121

// Windows systems have mixed support app files, different versions, missing features. etc.

[quote=151090:@Kem Tekinay]I see. At this phase I’m not worried about security/permission issues, i.e., I’m assuming the user has the privileges to replace their app. But since that doesn’t mean they will have the privileges to access all system services, it looks like an external app is required. Pity.

Who ships an OS without the proper zip tools installed natively?!?

Thanks to all for your input and help.[/quote]

Why not simply use an installer to replace the current app ?

For my purposes, that would be more work and less than ideal. The app this will be used in initially are drag and drop, no installer required.

Dunno, it was a zip of a Windows port of Midnight Commander.

Looks like others have had success with expand. But if it failed in my test, how reliable would it be in an xplat situation?

[quote=151148:@Tanner Lee]Dunno, it was a zip of a Windows port of Midnight Commander.

Looks like others have had success with expand. But if it failed in my test, how reliable would it be in an xplat situation?[/quote]

I sell tens of thousands of zip archives prepared on Mac with the OS X right click compress to Windows users every year. None of them ever complained it did not expand correctly. I think that is a pretty good level of compatibility.

On Windows, utilities such as Winzip can provide a legacy compression, which works fine with both Expand and Mac, but the “extra” compression is not compatible. I hate that kind of thing, and suspect that what you encountered. Most every zip utility on Windows has these pesky proprietary zip formats.

I would tend to stay away from anything that is not built in. But that’s just me.

Looks like that’s not an option in my case. Unfortunate that it will add 3.7 MB to the project, but I guess that’s not that big a deal in today’s high-speed world. I’m more distressed that it adds another step for Windows-targeting developers.

If a person prepares their update with Compress it will always work with Expand.

Any reason not to use .cab files for the updates in Windows?

Yes. I work on a Mac. :slight_smile:

Eventually I’ll expand to allow handling of various file types from cab to pkg to installer files. But that’s not what I need right now.

[quote=151163:@Kem Tekinay]Yes. I work on a Mac. :slight_smile:

Eventually I’ll expand to allow handling of various file types from cab to pkg to installer files. But that’s not what I need right now.[/quote]
Forget what you need, Kem, think about what WE need right now. :slight_smile:

Synchronicity is an amazing thing.
See https://forum.xojo.com/18150-howto-pack-unpack-files-with-use-of-xstandard-free-activex-tar-/0#p151133

gzip is different than zip, or did I miss something with that dll?

I did not pretend to give you a solution. Just to note that similar concerns appeared in two threads synchronously.

Understood.

Hi Kem,

Here are some interesting articles, although I have not created a native unzip program for Windows … yet :slight_smile:

This would need converting from Visual Basic 6 to Xojo: VB6 Declare Unzip Class

Another way is to unzip through COM. Instructions are here: Unzip by COM

Does this help or is thing on the wrong path?

Thanks Eugene. I decided to go the path of including an extra utility. Right now it’s 7z, but maybe something else later. For now, I have that part working.

[quote=151090:@Kem Tekinay]Who ships an OS without the proper zip tools installed natively?!?
[/quote]

many for many years… they want you to purchase a tool.

Not sure if have have read the link (https://forum.xojo.com/18150-howto-pack-unpack-files-with-use-of-xstandard-free-activex-tar-/0#p151133) But Xstandard provide also an ActiveX DLL for Zip. But this you will need to provide your email address for download it. (http://www.xstandard.com/en/documentation/xzip and the code to use it, is the same as for gzip and tar as shown in the above link.

What I understood it’s free for use in commercial applications as well.

[quote=150871:@Kem Tekinay]I want unzip files from my app. On the Mac/Linux size, I can count on the proper tools being available through the shell, but not in Windows, and I don’t want to install anything additional on the user’s system.

I found this which uses (I think) a VBScript to do the job. Before I go down the rabbit hole of testing, does anyone think this will not work on XP or higher?

Is there a better way to do it that doesn’t involve distributing an external app or installing a third-party class or plugin?

(I know and use @Thomas Tempelmann 's excellent zip class, but can’t for this project.)[/quote]

I just had some time to figure this out. The problem is, there is a bug in Xojo so you can’t use Shell.NameSpace in Xojo.

Here is the code that will work for windows:

  Dim ZipFile, ExtractTo As String
  Dim fso, objShell, FilesInZip, MyFolder1, MyFolder2 As OLEObject
  Dim ZipParams(1), ExtractParams(1) As variant
  
  
  ZipFile = "C:\\Temp\\test.zip"
  ExtractTo = "C:\\Temp\\Test"
  
  ZipParams(1) = ZipFile
  ExtractParams(1) = ExtractTo
  
  //If the extraction location does not exist create it
  fso = New OLEObject("Scripting.FileSystemObject")
  If NOT fso.FolderExists(ExtractTo) Then
    fso.CreateFolder(ExtractTo)
  End If
  
  
  
  objShell = New OLEObject("Shell.Application")
  MyFolder1 = objShell.Invoke("NameSpace", ZipParams)
  MyFolder2 = objShell.Invoke("NameSpace", ExtractParams)
  
  
  //More info see: http://msdn.microsoft.com/en-us/library/windows/desktop/bb787868%28v=vs.85%29.aspx
  //Extract the contants of the zip file.
  MyFolder2.CopyHere(MyFolder1.Items)
  
  
  fso = Nil
  objShell = Nil
  
exception err as oleexception
  msgbox err.message
1 Like

@John Hansen
That works fantastic!
I have seen several examples from your hand and i wonder where you got all that knowledge, it’s realy amazing!

Thanks for sharing this!