Mac: Saving information to file without modifying date stamp

407 views Asked by At

The Mac OS X Human Interface Guidelines says in their section about windows:

Note that if a user opens, moves, and closes a document window without making any other changes, you should save the new window position but you should not modify the file’s date stamp.

How are we supposed to do this? If I have a document-based application and I want to save documents’ windows’ positions and sizes in their files—without touching their date stamps—I override dataOfType:error, etc. But, as far as I can tell, all of these automatically modify the file’s date stamp.

There’s only one way I see to do this, and it’s kind of a hack: use NSFileManager to temporarily save the file’s old date stamp, save the window’s position in the file, and then use setAttributes:ofItemAtPath:error to change it back.

Is there a better way? Surely if it’s a common task...

1

There are 1 answers

5
Joshua Nozzi On BEST ANSWER

How about saving the window's position in NSUserDefaults instead of the document?