• 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
Follow-up on Cocoa Volume Names
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Follow-up on Cocoa Volume Names


  • Subject: Follow-up on Cocoa Volume Names
  • From: Evan Coyne Maloney <email@hidden>
  • Date: Mon, 7 Jan 2002 16:07:24 -0500

Hello,

Last week I asked a question regarding finding out the names of mounted volumes from the Cocoa frameworks. Several of you were kind enough to help by pointing me in the direction of using Carbon calls. (Thank you!) After some experimenting this weekend, however, I found that there is indeed a Cocoa mechanism for determining volume names, and I wanted to report it to you.

The issue I faced is that I was able to get the UNIX mount points for the volumes using the NSWorkspace mountedLocalVolumePaths method, but I could not figure out a way to turn those mount points into the volume names that the user would recognize. I wanted the same volume names that appear on the Finder desktop.

Well, I found a method on NSFileManager called displayNameAtPath: that takes an NSString* containing a filesystem path. As a test, I passed it @"
/", and "Macintosh HD" was returned! I then did more testing and found that for each path returned by mountedLocalVolumePaths, displayNameAtPath: returned the "desktop" name of the mounted volume.

The displayNameAtPath: method isn't documented very well, and I tried using it in various parts of the filesystem. For the most part, it returned a normal name, although in some cases, it seems to return names like "<nfs - 0001>" (for example, with the path "/Network/Servers/localhost").

Because of this, unfortunately, it seems that you can't use displayNameAtPath: generically whenever you want to display a path name to the user. So, for now, I'm using displayNameAtPath: only to display volume names.

Evan Coyne Maloney____________________________________________________
The six-legged fire-breathing dog email@hidden


  • Prev by Date: Re: NSBitmapImageRep from file
  • Next by Date: Newbie: NSGlyph <-> unicode ?
  • Previous by thread: Re: Notifications to other threads
  • Next by thread: Newbie: NSGlyph <-> unicode ?
  • Index(es):
    • Date
    • Thread