On 16.01.2009, at 07:18, Andreas Raab wrote:
> Keith Hodges wrote:
>> I am using ZipArchive to create a zip file, but when I expand said
>> zip
>> file the permissions of the top directory are:
>> drw-rw-rw which isn't very helpful.
>> I am on Mac OS X 10.5.5, using the Mac VM 3.8.18Ubeta1U
>> any ideas?
>
> Perhaps umask? Squeak doesn't set the permissions explicitly so the
> only thing I can imagine is that your unix umask isn't set
> appropriately.
IIUC Keith creates the zip in Squeak and unzips using other tools.
You can set the permissions for each archive member. Here's some
sample code from Etoys:
=======================
bundle: aFileName as: aBundleName title: aTitle version: aVersion id:
aBundleID icon: anSVGIcon
"Create a ZIP file named aBundleName-aVersion.xo containing
aBundleName.activity/
aFileName
bin/aBundleName.sh
activity/activity.info
activity/aBundleName-icon.svg
locale/...
"
| dir archive fileAttr execAttr dirAttr localFileName scriptName |
fileAttr := 16r81A4.
execAttr := 16r81ED.
dirAttr := 16r41ED.
dir := aBundleName, '.activity/'.
localFileName := FileDirectory localNameFor: aFileName.
scriptName := aBundleName, '.sh'.
archive := ZipArchive new.
#('' 'bin' 'activity' 'locale') do: [:dirName |
(archive addDirectory: dir, dirName) unixFileAttributes: dirAttr].
(archive addFile: aFileName as: dir, localFileName)
unixFileAttributes: fileAttr.
(archive addString: (self bundleScript: localFileName) as: dir,
'bin/', scriptName) unixFileAttributes: execAttr.
(archive addString: (self bundleInfoTitle: aTitle version: aVersion
bundle: aBundleID script: scriptName icon: aBundleName, '-icon') as:
dir, 'activity/activity.info') unixFileAttributes: fileAttr.
(archive addString: self bundleIcon as: dir, 'activity/',
aBundleName, '-icon.svg') unixFileAttributes: fileAttr.
archive members do: [:m | m setLastModFileDateTimeFrom: Time
totalSeconds].
archive writeToFileNamed: aBundleName, '-', aVersion asString, '.xo'.
archive close.
=======================
I don't quite remember how I came up with the constants ...
- Bert -