Re: determine volume name for folder that does not exist
Re: determine volume name for folder that does not exist
- Subject: Re: determine volume name for folder that does not exist
- From: Rosyna <email@hidden>
- Date: Sun, 9 Sep 2007 17:42:48 -0700
Well, paths don't actually have any knowledge of what volume they are
on (or if they're on a volume at all). Paths use mount points, which
have arbitrary locations (in Mac OS X, this is defaulted to a folder
in /Volumes/). However, if a volume is unmounted incorrectly, Mac OS
X will append a number to the name of the mount point, thereby making
the volume's name completely inconsistent with the path.
It'd be much better (for the user) if you stored an alias instead of
the path. Then even if the Alias does not resolve, you can call
FSCopyAliasInfo() to get the volume name (the real volume name). Note
that calling FSCopyAliasInfo() does no disk I/O and does not attempt
to resolve the alias, which is actually a good thing if all you want
is the info it returns.
Ack, at 9/9/07, Mitchell Livingston said:
I have been trying to determine the volume for a specific file path.
I have been using NSFileManager's componentsToDisplayForPath to get
the volume name, and then fileSystemAttributesAtPath to get info.
The problem is componentsToDisplayForPath doesn't seem to work when
the path doesn't exist. Is there a better way to give a potential
path and determine if its volume exists?
--
Sincerely,
Rosyna Keller
Technical Support/Carbon troll/Always needs a hug
Unsanity: Unsane Tools for Insanely Great People
It's either this, or imagining Phil Schiller in a thong.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden