I can not scan a local directory unless on of my installed files is chmod
755. i want to run a script on init() that will chmod 755 a file in the bin-debug directory.
Thanks in advance for your assistance.
I'm using the Native Process API but Mac Os seems to require my Perl script be set to executable. I'm trying to figure out how to set that script to executable in my code.
If I chmod 755 from the terminal the app works fine until I update or install a new version of the air app.
I attempted to chmod the file in my code but it's still not working.
Problem: I have a Perl script in my AIR App's install directory that needs executable permissions on a Mac.
Solution: Chmod the file in my AIR App.
My code looks something like the following:
if (Capabilities.os.indexOf("Mac OS") > -1) {
var dlFile:File = File.userDirectory;
var _chmod:File = new File("/bin/bash");
dlFile = new File(file);
var nativeProcess:NativeProcess = new NativeProcess();
var chmodStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
chmodStartupInfo.executable = _chmod;
var args:Vector.<String> = new Vector.<String>();
args.push("-c");
// Trace so I can make sure the command and path are correct in the debugger
trace ("\"chmod ugo+x '"+dlFile.nativePath+"'\"");
args.push("chmod ugo+x '"+dlFile.nativePath+"'");
chmodStartupInfo.arguments = args;
nativeProcess.addEventListener(NativeProcessExitEvent.EXIT, onExitError );
chmodStartupInfo.executable = new File(file);
var process:NativeProcess = new NativeProcess();
process.start(chmodStartupInfo);
I really hope this helps someone else.
Hello,
Are you still running into this problem? I assume you had the extendedDesktop profile set in your application descriptor?
Chris
There are two things you need to do before you can change file in a release build, as Chris told add the extendedDesktop profile but also not just build your .air file but in your publish settings change it to .dmg
This way your release build has the access it needs to the nativeProcess to be able to change the file to executable.
More can be read about this here on my blogpost about this issue:
North America
Europe, Middle East and Africa
Asia Pacific