• 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: Permissions problem after NSTask application launch
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Permissions problem after NSTask application launch


  • Subject: Re: Permissions problem after NSTask application launch
  • From: David Darby <email@hidden>
  • Date: Tue, 19 Apr 2005 09:24:35 +1000

Dear Sherm

Thanks a lot! Your intuition was correct. It was due to a "File not found" error, not permissions. By adding:

[task setCurrentDirectory:path];

the directories are found correctly.

The full working code is now:

- (void)awakeFromNib
{
	[self launchStudentVersion];
}

- (void)launchStudentVersion
{
  NSTask* task = [[NSTask alloc] init];
  NSMutableArray* args = [NSMutableArray array];
  NSBundle* appBundle = [NSBundle mainBundle];
 
  // set arguments
  NSString* firstCmd;
  NSString* cmd1 = @"/MyApp.app/Contents/MacOS/MyApp";
  NSString* cmd2 = @"-student";
  NSString* path = [[appBundle bundlePath] stringByDeletingLastPathComponent];
 
// set working directory to application's directory
[task setCurrentDirectory:path];
  firstCmd = [path stringByAppendingString:cmd1];
  [task setLaunchPath:firstCmd];
 
  [args addObject:firstCmd];
  [args addObject:cmd2];
 
  [task setArguments:args];
  [task launch];
 
  [NSApp terminate:self];
}


Thanks for your assistance.

David Darby
Em email@hidden

_______________________________________________
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


References: 
 >Permissions problem after NSTask application launch (From: David Darby <email@hidden>)
 >Re: Permissions problem after NSTask application launch (From: Sherm Pendley <email@hidden>)

  • Prev by Date: Drawing when dragging/flipping
  • Next by Date: Category or Protocol? (objc newbie)
  • Previous by thread: Re: Permissions problem after NSTask application launch
  • Next by thread: ColorCell, NSActionCell subclass
  • Index(es):
    • Date
    • Thread