Zip and Unzip: trevordevore script applied

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
trevix
Posts: 428
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Zip and Unzip: trevordevore script applied

Post by trevix » Mon Mar 26, 2018 12:31 pm

LC8.1.9 OSX 10.12.6
Trying to build a reliable Zipper and unzipped, using the RevZip commands, I built a simple stack using the scripts that Trevordevore so generously put on GitHub (https://gist.github.com/trevordevore/5246242).

After a few additions , I was able to zip and unzip, using all the Finder/Stack combinations (zip/unzip with the stack, zip with Finder, unzip with stack and viceversa).

The problem is the settings of permissions while UnZipping. Applications unzipped will not launch (the Finder reports: Unable to open the application).
I tried both setting the "pPerm" of "fileCreateAllFoldersInPath" to empty and to "shared".
Did not try on Windows.

Find here the sample stack.
1 - create a folder and put an App into it
2 - open the stack and zip the folder with it
3 - once zipped, unzip the zipped file of point 2, using the stack
4 - Try to launch the app inside the folder --doesn't work

Any help will be appreciated.
Trevix
Attachments
TheRevZipper2.livecode.zip
Just a stack
(5.03 KiB) Downloaded 36 times
Trevix

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6640
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Zip and Unzip: trevordevore script applied

Post by FourthWorld » Mon Mar 26, 2018 5:02 pm

A shell call to chmod can set the executable bit needed for apps on macOS and Linux.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

trevix
Posts: 428
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Zip and Unzip: trevordevore script applied

Post by trevix » Tue Mar 27, 2018 9:57 am

Yes.
I don't know how to use the shell, but in the Trevordevore script, we have this line for every file path:

Code: Select all

put shell(format("chmod %u%u%u %s ",7, 7, 7, pFilePath)) into theResult
But doesn't fix (anymore?) the permissions so to be able to run a unzipped application.
Instead, this applescript works:

Code: Select all

do shell script "chmod -R 775 " & MyPathToFolder  user name "MyUserName" password "MyPassword" with administrator privileges
But we have to ask the user for username and password.
So I was wondering: something changed in the last 5 years about OSX security so that is not enough anymore to run the "chmod" but we also need to pass username/password (even if the application is not unzipped to a protected folder, but to the desktop) ?

Regards and thanks for your time.
Trevix

trevix
Posts: 428
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Zip and Unzip: trevordevore script applied

Post by trevix » Wed Mar 28, 2018 9:26 pm

Must again correct myself:
The applescript works even without obtaining the username and password

Code: Select all

set myPOSIX to quoted form of POSIX path of "<TheAppPath>"
try
do shell script "chmod -R 775 " & myPOSIX
on error TheErr
return TheErr
end try
Trevix

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”