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?!?
[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 ?
[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.
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.
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=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