Re: "Ignore Ownership on this volume" check-box status
Re: "Ignore Ownership on this volume" check-box status
- Subject: Re: "Ignore Ownership on this volume" check-box status
- From: Lorenzo <email@hidden>
- Date: Fri, 16 Apr 2004 14:05:55 +0200
Hi,
as you suggested the tool vsdbutil works well, in the Terminal...
It tells me when the check-box "Ignore Ownership on this volume" is marked.
But [task terminationStatus] returns zero, either when the check-box is
marked or is not marked. So, I presume that I am forced to use the returned
string in order to understand the status of the check-box.
vsdbutil returns a string like this
Permissions on '/Volumes/Music' are enabled.
So, in Cocoa I create a string by myself, using stringWithFormat
Permissions on '/Volumes/Music' are enabled.
Then I compare these 2 string and if they are equal, this means that the
permissions are enabled. Also I make the NSLog print these 2 strings, and on
the log window they really seems to be equal, but the API
[enabledResultStr isEqualToString:enabledBaseStr] returns NO all the time.
So please, where is my error? In the string encoding?
Of course I have to allow even Japanese pathnames in my routine.
Here's my code.
---------------
NSArray *args = [NSArray arrayWithObjects:@"-c", volumePath, nil];
NSTask *task = [[NSTask alloc] init];
NSPipe *thePipe = [NSPipe pipe];
[task setLaunchPath:@"/usr/sbin/vsdbutil"];
[task setArguments:args];
[task setStandardOutput:thePipe];
[task launch];
[task waitUntilExit];
BOOL ownershipOK = NO;
NSData *dataOut = [[[task standardOutput]
fileHandleForReading] availableData];
if(dataOut){
NSString *enabledResultStr = [[NSString alloc]
initWith
Data:dataOut encoding:NSASCIIStringEncoding];
NSString *enabledBaseStr = [NSString
stringWithFormat:@"Permissions on \'%@\' are enabled.",
volumePath];
NSLog(@"vsdbutil output is: %@", enabledResultStr);
NSLog(@"enabledBaseStr is: %@", enabledBaseStr);
if([enabledResultStr isEqualToString:enabledBaseStr]){
NSLog(@"are equal");
ownershipOK = YES;
}
else NSLog(@"are NOT equal");
[enabledResultStr release];
}
[task release];
return ownershipOK;
Best Regards
--
Lorenzo
email: email@hidden
>
From: Sherm Pendley <email@hidden>
>
Date: Thu, 08 Apr 2004 12:06:28 -0400
>
To: Lorenzo <email@hidden>
>
Cc: Charles Srstka <email@hidden>, email@hidden
>
Subject: Re: "Ignore Ownership on this volume" check-box status
>
>
vsdbutil
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.