• 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: open package installer in bundle resources directory not working
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: open package installer in bundle resources directory not working


  • Subject: Re: open package installer in bundle resources directory not working
  • From: Mark Allan <email@hidden>
  • Date: Sat, 13 Dec 2008 11:09:09 +0000

An easier way may be to get NSWorkspace to do the work for you using the "openFile:" message.

http://tinyurl.com/NSWorkspace

Mark

On 13 Dec 2008, at 11:01, Mark Allan wrote:
Dennis,

You need to set the launch path of the executable within your NSTask - currently you're passing /usr/bin/open as an argument to nothing. There are two ways to do this: firstly, using the same logic you've got below, you can have the launch path be a shell and pass /usr/bin/ open as an argument to the shell; alternatively, make /usr/bin/open the launch executable.

Option one, notice the added "-c" switch to the shell:
[task setLaunchPath: @"/bin/tcsh"];
[task setArguments: [NSArray arrayWithObjects: @"-c", @"/usr/bin/ open", path, nil]];
Option two:
[task setLaunchPath: @"/usr/bin/open"];
[task setArguments: [NSArray arrayWithObjects: path, nil]];


Caveat: This is from memory, but it shouldn't be too far off.

Mark

On 13 Dec 2008, at 02:48, Denis Bohm wrote:
I'm trying to distribute an installer within my own application bundle in the resources directory and run it from my application. When I try to run it from the debugger I get the error "launch path not accessible". However, if I then use the terminal to run the command by hand using the same path it works.

Anyone have any idea why it fails to run it from the application?



Code in my application:

NSTask* task = [[NSTask alloc] init];
NSString* path = [[NSBundle mainBundle] pathForResource:@"FTDIUSBSerialDriver" ofType:@"pkg"];
NSLog(path);
[task setArguments: [NSArray arrayWithObjects: @"/usr/bin/open", path, nil]];
[task launch];


Output from the debugger when it fails:

2008-12-12 18:34:15.179 Firefly Upload Center[3364:813] /Users/ denis/sandbox/firefly/design/device/upload/mac/UploadCenter/build/ Debug/Firefly Upload Center.app/Contents/Resources/ FTDIUSBSerialDriver.pkg
(gdb) continue
Current language: auto; currently objective-c
Firefly Upload Center: unexpected exception: NSInvalidArgumentException: launch path not accessible
-[NSConcreteTask launchWithDictionary:] (in Foundation) + 2490
-[NSConcreteTask launch] (in Foundation) + 41
-[FDApplication applicationDidFinishLaunching:] (in Firefly Upload Center) (FDApplication.m:67)
_nsnote_callback (in Foundation) + 364
__CFXNotificationPost (in CoreFoundation) + 362
_CFXNotificationPostNotification (in CoreFoundation) + 179
-[NSNotificationCenter postNotificationName:object:userInfo:] (in Foundation) + 128
-[NSNotificationCenter postNotificationName:object:] (in Foundation) + 56
-[NSApplication _postDidFinishNotification] (in AppKit) + 125
-[NSApplication _sendFinishLaunchingNotification] (in AppKit) + 77
-[NSApplication(NSAppleEventHandling) _handleAEOpen:] (in AppKit) + 284
-[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] (in AppKit) + 98
-[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] (in Foundation) + 655


This works from the command line:

open "/Users/denis/sandbox/firefly/design/device/upload/mac/ UploadCenter/build/Debug/Firefly Upload Center.app/Contents/ Resources/FTDIUSBSerialDriver.pkg"

_______________________________________________

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



_______________________________________________

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


References: 
 >open package installer in bundle resources directory not working (From: Denis Bohm <email@hidden>)
 >Re: open package installer in bundle resources directory not working (From: Mark Allan <email@hidden>)

  • Prev by Date: Re: open package installer in bundle resources directory not working
  • Next by Date: Re: How to create blunt Edges for a NSWindow
  • Previous by thread: Re: open package installer in bundle resources directory not working
  • Next by thread: Re: open package installer in bundle resources directory not working
  • Index(es):
    • Date
    • Thread