File Path Tracking

Uli Kusterer kusterer at gmail.com
Mon Oct 15 12:17:01 PDT 2007


Am 15.10.2007 um 21:10 schrieb Daniel Hazelbaker:
> I have a program that keeps track of files by using the Unix Path  
> to the file (as that is what is used to open and work with the  
> files when the time comes).  I have run into a problem where when  
> the files are stored on a network volume my program can  
> occasionally no longer find the files because the path might have  
> changed (i.e. "/Volumes/Data" becomes "/Volumes/Data 1"). This is  
> particularly a problem with Fast User Switching as "Data" might be  
> mounted a number of times.
>
> How might I deal with this type of issue?

  As you noticed, file paths are not suitable for referencing files  
reliably. Check out Aliases, which can be used for this and are  
reliable. There's the CoreFoundation/Carbon Alias Manager API for  
this, or alternately you can use one of the Cocoa wrappers, like  
Nathan Day's NDAlias.

Cheers,
-- M. Uli Kusterer
http://www.zathras.de





More information about the MacOSX-dev mailing list