• 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: How to get hard drive name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get hard drive name


  • Subject: Re: How to get hard drive name
  • From: Chris Parker <email@hidden>
  • Date: Tue, 20 Jan 2004 14:23:04 -0800

On Jan 20, 2004, at 12:54 PM, J Nozzi wrote:

I'd responded with the expandtilde method from the NSUserHome (names not exact, I know - I'm in a hurry. ;-) ) but he made a valid point that the mount point is still "/Users/..." and not /Drive/Users/... nor /Volumes/Drive/Users ...

His question is a bit more complicated and I admit I'm stumped!

It's interesting to look at what -[NSFileManager componentsToDisplayForPath] returns under different circumstances.

If I've got a user (call them 'joelocal') - on most Mac OS X installations, their home directory is going to be /Users/joelocal - let's also say the root partition's name is "Fred".

Calling -componentsToDisplayForPath: on /Users/joelocal gives you the following array:

Fred
Users
joelocal

In this case, the "actual" mount point for the volume containing the user's home directory is '/' - which is called "Fred".

You can get a similar result by calling [[NSFileManager defaultManager] displayNameAtPath:@"/"], which returns the name of the boot volume.

Having a directory called "Downloads" on an external FireWire drive called "Stuff" yields the following path: /Volumes/Stuff/Downloads - calling -componentsToDisplayForPath: yields

Stuff
Downloads

So depending on where your volume is mounted, you'll get different results.

I hope this answers the question.

.chris

--
Chris Parker
Cocoa Frameworks Engineer
Apple Computer, Inc.
_______________________________________________
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: 
 >How to get hard drive name (From: Lorenzo <email@hidden>)
 >Re: How to get hard drive name (From: J Nozzi <email@hidden>)

  • Prev by Date: Re: How to get hard drive name
  • Next by Date: Re: *****SPAM*****How to convince company I should switch to Cocoa
  • Previous by thread: Re: How to get hard drive name
  • Next by thread: Re: How to get hard drive name
  • Index(es):
    • Date
    • Thread