• 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
I cant get my helper tool to launch
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

I cant get my helper tool to launch


  • Subject: I cant get my helper tool to launch
  • From: April Gendill <email@hidden>
  • Date: Tue, 21 Dec 2004 15:43:06 -0700

Ok I copied the example code from Apple's site and then modified it for my app. This code is suppose to step through a list of files and remove only files not directories.
It does not work. It races through the loop never launching the helper app at all. What am I doing wrong???


April.

OSStatus myStatus;
FILE *myCommunicationsPipe=NULL;
AuthorizationFlags myFlags = kAuthorizationFlagDefaults;
AuthorizationRef myAuthorizationRef;
myStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, myFlags, &myAuthorizationRef);
AuthorizationItem myItems = {kAuthorizationRightExecute, NULL, 0};
AuthorizationRights myRights = {1, &myItems};
myFlags = kAuthorizationFlagDefaults | kAuthorizationFlagInteractionAllowed | kAuthorizationFlagPreAuthorize | kAuthorizationFlagExtendRights;
myStatus = AuthorizationCopyRights (myAuthorizationRef,&myRights, NULL, myFlags, NULL );

if (myStatus != errAuthorizationSuccess){
[progressWindow orderOut:self];
return;
}
while(current = [iter nextObject]){
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]];
BOOL fileThere = [[NSFileManager defaultManager] fileExistsAtPath:current isDirectory:&isDir];



if (myStatus != errAuthorizationSuccess){
[progressWindow orderOut:self];
return;
}


if(fileThere && !isDir){


NSString * t = [[NSBundle mainBundle]resourcePath];
NSString * toolPath = [NSString stringWithFormat:@"%@/helper",t];

char *myArguments[] = { [current cString], NULL };
char * tp = [toolPath cString];
FILE *myCommunicationsPipe = NULL;

char myReadBuffer[128];


myFlags = kAuthorizationFlagDefaults;
myStatus = AuthorizationExecuteWithPrivileges(myAuthorizationRef, tp, myFlags,
myArguments,&myCommunicationsPipe);




if (myStatus == errAuthorizationSuccess){
[pi incrementBy:1.0];
}
}//end if there and not dir
else if (!fileThere || isDir){
[pi incrementBy:1.0];
}
}//end while
 _______________________________________________
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:
    • I need some help with the security framework please WAS: I cant get my helper tool to launch
      • From: April Gendill <email@hidden>
  • Prev by Date: Strange NSTextField behaviour
  • Next by Date: Authtication Dialog - pswd field focus?
  • Previous by thread: Re: Strange NSTextField behaviour
  • Next by thread: I need some help with the security framework please WAS: I cant get my helper tool to launch
  • Index(es):
    • Date
    • Thread