Reputation: 6675
I am having a hard time finding from where my application is picking up its window dock and location settings. I removed the related plist files and folders from the following directories:
But the old window settings are retained when I launch the application. The application is using CFPreferencesCopyValue method to read preference values:
::CFPreferencesCopyValue("Toolbars:MyTools:Application", "kCFPreferencesCurrentApplication", kCFPreferencesCurrentUser, kCFPreferencesCurrentHost);
I am not very familiar with Mac's preferences mechanism. Can someone explain what could be happening here? Thanks
Upvotes: 2
Views: 7600
Reputation: 6581
This problem hit me recently so I thought I'd post the answer here belatedly.
When you delete the preferences on a Mac (plist file) make sure you clear the cached preferences otherwise Java programs can keep working with the cached settings. You can:
after you have deleted your plist file
killall -u <your-user-name> cfprefsd
OR
reboot
Items 2. and 3. will cause the cache to be cleared and then your preferences will be reloaded as the cfprefsd restarts automatically.
I hope that helps.
Upvotes: 2
Reputation: 4660
The NSUserDefaults
on Mavericks (at least) are cached and it is not recommended to edit the plist files manually. The actual files reside in a container folder (you may know this folder from sandboxing).
But you can use the command line utility defaults
to edit, change or delete preferences. To delete the defaults (= reset defaults for your app) you can run in terminal:
defaults delete com.myapp.* && rm -rf ~/Library/Preferences/com.myapp.*
This is taken from a blog entry that shows in detail explanations on user defaults and mavericks.
Upvotes: 1