Zip with MacOs specific files

I don’t have a current license so I can’t test…

I copy paste those lines of code from the documentation. And we use outputFile as it contains the path of the Zipped file.

To answer Kem: I zipped a folder containing jpg files with customised icons (the photo as icon). When I unzipped the ZIP, the jpg files loose their personals icons and the size of the folder window was not the same as the original.
I’m not on my Mac, if I’m unclear I will post tomorrow a screen capture with the original folder and the unzipped folder.

Thanks for yours answers.

Right, so your ZIP file is indeed losing .DS_Store (and perhaps other files starting with a period). If you can verify that those files are indeed in your source folder and are being omitted from your archive, you should definitely file a bug report; that’s really not good behavior, since it isn’t mentioned in the documentation.

That would be a significant issue. .XLSX files are zip files and they require a file call “.rels”, which is vital to the xlsx file working.

I just confirmed that files starting with . are not included in the archive.

I’ve created a feature request:
Zip feature should include a flag that chooses to includes hidden files or not, or to always include them
https://tracker.xojo.com/xojoinc/xojo/-/issues/74469

Oddly, zipping folders on a Mac normally gets me a bucket of stuff I dont want included. _DSStore, and _MacOSX folders and subfolders which show up a s ugly in Windows.

To get them, I right click on a folder in Finder and choose ‘compress’
That creates Archive.zip , and all the files are contained.
It should be possible to issue a command line or applescript to do the same.
I appreciate its not a fix for the Xojo zip functionality, but it’s likely only those without access to MBS plugins ( or the various other zip solutions that have been available for a long time) would use this.

I currently make calls to a shell and run the command line zip / unzip commands, however, that is not cross platform. Which is what is so great about the new FolderItem options.

Can someone confirm whether or not this is actually happening?

I’m looking for a definitive “Yes, I have tested this and .DS_Store is confirmed {being skipped | included}” OP is kind of describing the experience, and nobody has confirmed in a technical way.

Plugins Pro uses MBS to handle ZIP right now because it was created long ago.

Ian confirmed it above: files whose names start with periods are not included in archives.

This really isn’t acceptable and any fix for this should be fast-tracked because someone is going to silently lose data this way.

Oh thanks, I must have missed that skimming for something other than “This could be a significant issue”

Sorry, Ian.

Sorry, I’ve made it bold. I’m currently creating an example project to demonstrate it. Done… attached to by bug report.

1 Like

The past three issues I’ve had with zipping FolderItems are:

  1. Can you ignore the .DS_Store files?
  2. Can it add aliases/shortcuts that don’t just zip the pointed-to file?
  3. Can it add empty folders ie no file in folder, it doesn’t bother including it?

Other issues might be how it handles invalid file/folder permissions, files moved/deleted/modified during zipping, retention of Created/Modified dates and locked files.

While I’m glad to have zip/unzip support in the xojo framework, and I’m sure it will improve over time, it’s vastly feature incomplete. Even something as simple as encrypted archive support is missing.

In the meantime, both MBS and Chilkat offer more feature-complete implementations for compression and decompression and will properly add the metadata files to your archives.

I agree this should be considered a bug though. I would be flabbergasted if the backup archive my program created for my website didn’t have .htaccess files.

I think you’re correct it should be a bug. I’ve updated my report. Please sign on if you are affected by this or agree.
Any proposed filter mechanism could then choose what to exclude.

Zip feature should include hidden files
https://tracker.xojo.com/xojoinc/xojo/-/issues/74469

Ian, I ran your test project and your hidden file “.hiddenfile” is there when I unzip.

In the screencapture below, the window at the top is the original folder content, just below (in the middle) it is the unzipped folder zipped with the Finder, and below that (at the bottom) it is the unzipped on the Xojo’s zip.


Both zip (Finder and Xojo) lost the folder window size (which is, i suppose, in the .DS_Store). But the Finder’s ZIP keep the personnal icon and the Xojo’s Zip lost it.
I have an “.htaccess” in the subfolder “B2_ccx” and it is in the Finder Zip AND in the Xojo Zip.

And I came back with the other strange thing I notice. Those 2 codes do the same thing, but the first one give error when we verify code (Command-K) and not the second one.


Should I file a bug report?

Where is the error?

You have 2 caution flag in the code of Button2 and no caution flag in the code of Button3.
Those variables are used, then I suppose there is no reason to flag them as unused.

That’s odd. Yesterday, I was just out of bed after 4 days sick with Covid. I hadn’t noticed the problem. I’ve just looked now and you are correct. It is there. That means I’m going back to the original question of why my ‘.rels’ file wasn’t there when I used Xojo to zip it.

Well this is odd… the files seem to be there today. I’ve either got to put yesterday it down to Covid hallucinations (can you hallucinate the absence of something), or something else is different today. For now it seems like the former!

I just have to admit error and say, for now, zip methods do seem to include hidden files.

Sorry for the confusion and noise. I have closed by bug report.

Thomas, I just tried your test and it didn’t include the .DS_Store file in the zip.

I notice that .DS_Store files have extended attributes is it perhaps that that is causing the file to not be included in the zip?

ls -lA@ .DS_Store 
-rw-r--r--@ 1 iakennedy  staff  6148 18 Oct 12:19 .DS_Store
	com.apple.FinderInfo	  32