• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Launch Path Not Accessible
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Launch Path Not Accessible


  • Subject: Re: Launch Path Not Accessible
  • From: Steve Cronin <email@hidden>
  • Date: Sat, 02 Aug 2008 16:20:08 -0500

Andrew:

Thanks for the slap on the head!
So I chmod'ed the file and no longer get the 'not accessible error' YEAH!


BUT now I get:
*** NSTask: Task create for path '/Users/steve/Library/Application Support/XYZ/Scripts/myUseful.o' failed: 88, "Malformed Mach-o file"


So I must be missing something about the contents of script files.
Here's my script:

myUseful.m
#import <Cocoa/Cocoa.h>
int main(int argc, char **argv)
{
char dummy;
read(STDIN_FILENO, &dummy, 1);
[NSAutoreleasePool new];
NSURL *url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:argv[1]]];
LSOpenCFURLRef((CFURLRef)url, NULL);
return 0;
}


You will just have to trust me that I DO need to launch the file in this manner.
What do I need to do to this file to make it into the correct format?


THANKS AGAIN for the chmod help!
Steve

On Aug 2, 2008, at 3:26 PM, Andrew Farmer wrote:

On 02 Aug 08, at 13:01, Steve Cronin wrote:
I'm trying to do something that seems like it should be easy, but I'm stymied by what I think is a permissions error I don't understand.

I'm trying to run a script using NSTask.
I have the static script stored as a separate file in my bundle.
I have created a folder in my "Applications Support" directory called "Scripts" and copied my script and several items into this directory.
Note that this has a space in the full pathname!


SO I have tried the following:
NSString *myScriptPath = [[self scriptsFolderPath] stringByAppendingPathComponent:@"myUseful.script"]; //yes I have verified this is a valid path!!!
NSTask *task = [[[NSTask alloc] init] autorelease];
[task setLaunchPath: myScriptPath];
[task setArguments:[NSArray arrayWithObject:...]];
[task setStandardInput:[NSPipe pipe]];
[task launch];


ERRROR: launch path not accessible

Are you sure myUseful.script is directly executable? Just because it's double-clickable in the Finder doesn't mean it's executable... if this is an AppleScript, though, you may have better luck working with NSAppleScript.


So, thinking that the 'space' maybe wanking out the 'setLaunchPath' I tried to convert to a 'safe' url path:
NSURL *myScriptFileURL = [NSURL fileURLWithPath:t];
...
[task setLaunchPath:[myScriptFileURL absoluteString]];

Nope. NSTask takes a filesystem path, not a URL.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Launch Path Not Accessible
      • From: "Omar Qazi" <email@hidden>
    • Re: Launch Path Not Accessible
      • From: "Michael Ash" <email@hidden>
References: 
 >Launch Path Not Accessible (From: Steve Cronin <email@hidden>)
 >Re: Launch Path Not Accessible (From: Andrew Farmer <email@hidden>)

  • Prev by Date: NSImage size vs. representations' sizes
  • Next by Date: Re: pointers in objective-c?
  • Previous by thread: Re: Launch Path Not Accessible
  • Next by thread: Re: Launch Path Not Accessible
  • Index(es):
    • Date
    • Thread