0 Replies
      Latest reply on Oct 16, 2019 5:15 AM by foxandrabbit
      foxandrabbit Level 1 Level 1 (0 points)

        Hi,

         

        in this particular case, I'm trying to modify com.apple.finder.plist which is located at ~/Library/SyncedPreferences/.
        I tried by using the CFPreferences API. However, CFPreferencesCopyAppValue and CFPreferencesCopyValue return both nil, e.g. for key FinderTags and appID com.apple.finder. If I use a key from ~/Library/Preferences/com.apple.finder.plist, such as FavoriteTagNames, reading it with CFPreferencesCopyAppValue works. Is there a way to point the CFPreferences API to the SyncedPreferences plist instead?

         

        Here is what I've tried in Playground:

        // 1. --> returns nil
        let appPref = CFPreferencesCopyAppValue("FinderTags" as CFString, "com.apple.finder" as CFString)

        //  2. --> returns nil
        let appPref = CFPreferencesCopyAppValue("FinderTags" as CFString, "~/Library/SyncedPreferences/com.apple.finder" as CFString)

        // 3. --> returns nil

        let appPref = CFPreferencesCopyValue("FinderTags" as CFString, "com.apple.finder" as CFString, kCFPreferencesAnyUser, kCFPreferencesAnyHost)

        // 4. --> returns nil

        let appPref = CFPreferencesCopyValue("FinderTags" as CFString, "~/Library/SyncedPreferences/com.apple.finder" as CFString, kCFPreferencesAnyUser, kCFPreferencesAnyHost)

        // 5. --> returns ["", "Red", "Orange", "Yellow", "Green", "Purple", "Gray"]

        let appPref = CFPreferencesCopyAppValue("FavoriteTagNames" as CFString, "com.apple.finder" as CFString)

         

        Cheers,

        Dennis