Zipping an application package by script
Mark Talluto
userev at canelasoftware.com
Wed Sep 10 12:56:15 EDT 2008
On Sep 9, 2008, at 10:18 PM, Stephen Barncard wrote:
> I don't really care if the DS_Store files are in there or not ( I
> care not about Windoze ) - that was just an issue that stopped the
> shell call. But that does that mean there are several versions of
> Zip on the machine?
>
> 1. zip for rev
> 2. zip for the shell
> 3. whatever Automator uses (perhaps shell, above)
> 4. The finder "Compress" menu item... (which results is what I
> want) -- It has no problems....
>
> Is there a 'domenu' applescript ?
>
>
> so near so far...
Hi Stephen,
These are the functions we use here to deal with unzipping in both Win
and Mac. You can use shell to do zipping as well.
on CSUnzip pPathtoFile
if the platform is "MacOS" then
CSMacUnzip pPathtoFile
else
CSWinUnzip pPathtoFile
end if
end CSUnzip
on CSMacUnzip pPathtoFile
replace " " with "\ " in pPathtoFile
put "unzip -o " & pPathtoFile & " -x *_M*" into tShellCmd
put shell(tShellCmd) into log
end CSMacUnzip
on CSWinUnzip pPathtoFile
--SET UP WHERE TO UNZIP TO
set the itemdelimiter to "/"
put pPathtoFile into tZipTarget
delete the last item of tZipTarget
put "/" after tZipTarget
--READ WHAT'S INSIDE THE ZIP FILE
revZipOpenArchive pPathtoFile,"read"
put revZipEnumerateItems(pPathtoFile) into tZipContents
--ACTUALLY UNZIP
repeat with x=1 to the number of lines of tZipContents
if the last char of line x of tZipContents is "/" then
create folder tZipTarget & line x of tZipContents
revZipExtractItemToFile pPathtoFile, (line x of
tZipContents), (tZipTarget & (line x of tZipContents))
end repeat
--CLEAN UP AFTER YOURSELF
revZipCloseArchive pPathtoFile
end CSWinUnzip
Mark Talluto
http://www.canelasoftware.com
More information about the use-livecode
mailing list