views:

81

answers:

1

I have only a little question:

Why the CFPreferences-API creates multiple files in my UserPrefs-Directory? All the files have my Bundle-Identifier as name and all (except the one, the original) have added a suffix like this:

  • com.myComp.myApp.plist <- (only this plist-file should be created)
  • com.myComp.myApp.plist.0qzcicc
  • com.myComp.myApp.plist.8dhjfht
+3  A: 

This looks very much like a side effect of atomic writing.

Atomic writing means that, whenever a file is to be written from an NSData (or other) object, the file is first created using a temporary file name in the same directory. Then all data is written into that file (an operation which is usually not atomic). After closing the file it is renamed to the original file name. The rename is an atomic step, which ensures that any other process that might look at the file sees either the complete old file or the complete new file. There’s no way that a process might see only half of a file.

The funny named files look like they are artifacts from this process. Maybe your app crashed in the middle of an atomic write?

Nikolai Ruhe