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: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
trevix
Posts: 958
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 194 times
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
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
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

trevix
Posts: 958
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
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

trevix
Posts: 958
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
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”