Re: filesystem assumptions [was Re: Question]
Re: filesystem assumptions [was Re: Question]
- Subject: Re: filesystem assumptions [was Re: Question]
- From: Karl Kuehn <email@hidden>
- Date: Fri, 10 Jan 2003 16:03:18 -0500
The one issue that makes this a little more complex is how Cocoa saves
files. Instead of writing to the same inode(s), Cocoa instead makes a
new file, writes to it, and then replaces the old file with the new. It
does this to avoid some complex problems if something goes weird in the
middle of the write, say another program is trying to write to the same
file at the same moment... (especially true when you are working with
large files and may have the file open for writing for minutes or
longer).
There is a solution to this problem, which is to get the inode
reference to the file (the same one that an alias first tries to
reference), and keep this around until you go to replace the file. Then
at the last moment look up the inode reference to see where the file
is, and then replace in that location. Very possible, but just not what
it has been doing up to this point...
While we are on the subject... I also think that the Cocoa file
methods need to address permissions when replacing a file. If I chmod a
file, then write-replace it with Cocoa methods the resulting (new) file
will have the generic permissions for that folder (as if it was a new
file). A better method would look at the file permissions and re-set
them on the new file. I am working on a project that needs to be
chowned to root in order to setuid and every time I build it I have to
manually chown (and chmod) in order to be able to de-bug it (or run it
generally).
This all could be solved with some small changes to the file handling
in Cocoa, and probably done without breaking any existing apps, but we
need to tell Apple we want it.
Karl Kuehn
email@hidden
On Friday, January 10, 2003, at 11:33 AM, Alex Rice wrote:
In an NSDocument Cocoa application, if you rename the document in the
Finder the Finder will find the corresponding NSDocument object and
send it a setFilename: message. Pretty cool.
Maybe it would not be impossible to get NSApplication and NSBundle to
work in the same manner?
_______________________________________________
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.