Re: How to get hard drive name
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.