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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to