• 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: Hard disk partition name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Hard disk partition name (From: Gideon King <email@hidden>)

  • Prev by Date: Re: Memory management (release)
  • Next by Date: Re: cocoa-dev digest, Vol 2 #4140 - 15 msgs
  • Previous by thread: Hard disk partition name
  • Next by thread: NSMovieView and strange image
  • Index(es):
    • Date
    • Thread