• 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 bundled application before main application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Launch bundled application before main application


  • Subject: Re: Launch bundled application before main application
  • From: Claudio Procida <email@hidden>
  • Date: Sun, 19 Nov 2006 20:50:40 +0100


On 19 nov 2006, at 20:09, Mark Munz wrote:

Going in before NSApplicationMain() is called will be much more tricky

Another option might be to put code in the

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification

If the data file needs to be converted, then call the program there.
If the conversion doesn't require user interactivity, you could call
it with an NSTask and then just wait for it to complete (perhaps while
running a spinner progress bar).

Once the task is complete, you could continue on your way.

I've tried using NSTask. Anyway I get this weird error:

2006-11-19 20:36:27.114 MiniBatteryLogger[15630] *** NSTask: Task create for path /Users/delphine/Sviluppo/SVN/MiniBatteryLogger/trunk/ build/Release/MiniBatteryLogger.app/Contents/Resources/Migration Agent.app failed: 13, "Permission denied".

Relevant code:

- (void)applicationDidFinishLaunching:(NSNotification *)notif
{
/* Launch Migration Agent if needed */
if (![[defaults objectForKey:MBLDidPerformMigration] boolValue])
{
NSString *migrationAgentPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Migration Agent.app"];

[NSTask launchedTaskWithLaunchPath:migrationAgentPath
arguments:[NSArray arrayWithObject:@""]];
[defaults setObject:[NSNumber numberWithBool:YES]
forKey:MBLDidPerformMigration];
[defaults synchronize];
}
}


I'm using the class method launchedTaskWithLaunchPath:arguments: here, but since I need a blocking call it seems I have to instantiate an object and call [theTask waitUntilExit];

--
Claudio Procida
Emeraldion Lodge
http://www.emeraldion.it


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Launch bundled application before main application
      • From: Claudio Procida <email@hidden>
References: 
 >Launch bundled application before main application (From: Claudio Procida <email@hidden>)

  • Prev by Date: Re: IOPMSchedulePowerEvent - laptop lid closed
  • Next by Date: Re: NSXML - preserving white space in new elements
  • Previous by thread: Launch bundled application before main application
  • Next by thread: Re: Launch bundled application before main application
  • Index(es):
    • Date
    • Thread