Re: Hard disk partition name
Re: Hard disk partition name
- Subject: Re: Hard disk partition name
- From: Fritz Anderson <email@hidden>
- Date: Fri, 7 May 2004 12:06:10 -0500
An egregious kluge follows. This has been typed fresh into Mail, so all
caveats apply.
@interface NSString (carbonPath)
- (NSString *) carbonFromPOSIXPath;
@end
@implementation NSString (carbonPath)
- (NSString *) carbonFromPOSIXPath
{
NSString * retval = nil;
NSURL * fileURL = [NSURL fileURLWithPath: self];
if (fileURL) {
retval = (NSString *) CFURLCopyFileSystemPath((CFURLRef) fileURL,
kCFURLHFSPathStyle);
[retval autorelease];
}
return retval;
}
@end
On 6 May 2004, at 6:46 PM, Gideon King wrote:
I am doing some work where I need to call Applescript from Cocoa, and
as part of that, I need to tell it to open a file using the old style
syntax "Macintosh HD:Users:fred:file.ext". Now I can get the user's
home directory by calling NSHomeDirectory(), but that doesn't include
the partition name (in this case "Macintosh HD").
How do I get the name of the partition so I can tell AppleScript the
right thing? Are there any gotchas for network mounted directories
etc?
_______________________________________________
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.