FSRef-like primitive?
FSRef-like primitive?
- Subject: FSRef-like primitive?
- From: Paul Bayley <email@hidden>
- Date: Sat, 18 Aug 2001 00:03:48 -0700
Hello,
I hope this isn't a dead topic before I start it. I was wondering if Cocoa is ever going to have a primitive homogeneous to Carbon's FSRef. The problem is a lot of methods in Cocoa take a POSIX path in the form of an NSString as an argument and I see this as leading to trouble down the road if the path of a file is changed by another application. Personally I don't understand why file paths are used in this manner since they don't necessarily point to the same file at time A and B. However I don't see any way to remove the assumption that a file's path is constant since I can't generate the file path from some kind of file system reference when I need it (thus using the existing API without assuming the file path is constant).
My request is probably easier to ask for than to implement. Basically I want a lightweight object analogous to NSFSRef (CFFSRef too perhaps) which could either be used as an NSString or converted to a CFURL thus allowing me to use this otherwise nice API without assuming that file paths are constant. Somebody told me Apple is changing NSDocument to do something to this effect, but that's a huge class full of stuff I don't even want to deal with for a simple file operation.
This class could also post a notification if the file was modified by another process.
A better solution perhaps would be to add methods analogous to those wanting file paths to want FSRefs to avoid having to lookup the file path every time, but perhaps that's an unreasonable request.
I would like to use Cocoa very much, however mixing Carbon file i/o calls and Cocoa for everything else kind of defeats the point of a homogeneous application framework.
Thank you for your help