Mac Developer Library

Developer

System Configuration Framework Reference SCPreferencesPath Reference

Options
Deployment Target:

On This Page
Language:

SCPreferencesPath Reference

The SCPreferencesPath programming interface allows an application to load and store XML configuration data in a controlled manner and provide the necessary notifications to other applications that need to be aware of configuration changes.

The functions in this programming interface view the data as a collection of dictionaries of key-value pairs and an associated path name. The root path ("/") identifies the top-level dictionary. Additional path components specify the keys for subdictionaries.

For example, the following dictionary can be accessed via two paths. The root path ("/") returns a dictionary with all keys and values. The path "/path1" returns only the dictionary with the "key3" and "key4" properties.

  1. <dict>
  2. <key>key1</key>
  3. <string>val1</string>
  4. <key>key2</key>
  5. <string>val2</string>
  6. <key>path1</key>
  7. <dict>
  8. <key>key3</key>
  9. <string>val3</string>
  10. <key>key4</key>
  11. <string>val4</string>
  12. </dict>
  13. </dict>

Each dictionary can also include the kSCResvLink ("__LINK__") key. The value associated with this key is interpreted as a link to another path. If this key is present, a call to the SCPreferencesPathGetValue function returns the dictionary specified by the link.

Functions

  • Creates a new path component rooted at the specified path in the dictionary hierarchy.

    Declaration

    Swift

    func SCPreferencesPathCreateUniqueChild(_ prefs: SCPreferences, _ prefix: CFString) -> CFString?

    Objective-C

    CFStringRef SCPreferencesPathCreateUniqueChild ( SCPreferencesRef prefs, CFStringRef prefix );

    Parameters

    prefs

    The preferences session.

    prefix

    The parent path.

    Return Value

    A string representing the new (unique) child path, or NULL if the specified path does not exist.

    Availability

    Available in OS X v10.1 and later.

  • Associates the specified dictionary with the specified path.

    Declaration

    Swift

    func SCPreferencesPathSetValue(_ prefs: SCPreferences, _ path: CFString, _ value: CFDictionary) -> Bool

    Objective-C

    Boolean SCPreferencesPathSetValue ( SCPreferencesRef prefs, CFStringRef path, CFDictionaryRef value );

    Parameters

    prefs

    The preferences session.

    path

    The path.

    value

    The dictionary of data to be stored at the path.

    Return Value

    TRUE if successful; otherwise, FALSE.

    Availability

    Available in OS X v10.1 and later.

  • Associates a link to a second dictionary at the specified path.

    Declaration

    Swift

    func SCPreferencesPathSetLink(_ prefs: SCPreferences, _ path: CFString, _ link: CFString) -> Bool

    Objective-C

    Boolean SCPreferencesPathSetLink ( SCPreferencesRef prefs, CFStringRef path, CFStringRef link );

    Parameters

    prefs

    The preferences session.

    path

    The path.

    link

    The link to be stored at the path.

    Return Value

    TRUE if successful; otherwise, FALSE.

    Availability

    Available in OS X v10.1 and later.

  • Returns the dictionary associated with the specified path.

    Declaration

    Swift

    func SCPreferencesPathGetValue(_ prefs: SCPreferences, _ path: CFString) -> CFDictionary?

    Objective-C

    CFDictionaryRef SCPreferencesPathGetValue ( SCPreferencesRef prefs, CFStringRef path );

    Parameters

    prefs

    The preferences session.

    path

    The path.

    Return Value

    The dictionary associated with the specified path, or NULL if the path does not exist.

    Availability

    Available in OS X v10.1 and later.

  • Returns the link associated with the specified path.

    Declaration

    Swift

    func SCPreferencesPathGetLink(_ prefs: SCPreferences, _ path: CFString) -> CFString?

    Objective-C

    CFStringRef SCPreferencesPathGetLink ( SCPreferencesRef prefs, CFStringRef path );

    Parameters

    prefs

    The preferences session.

    path

    The path.

    Return Value

    The link associated with the specified path, or NULL if the path is not a link or does not exist.

    Availability

    Available in OS X v10.1 and later.

  • Removes the data associated with the specified path.

    Declaration

    Swift

    func SCPreferencesPathRemoveValue(_ prefs: SCPreferences, _ path: CFString) -> Bool

    Objective-C

    Boolean SCPreferencesPathRemoveValue ( SCPreferencesRef prefs, CFStringRef path );

    Parameters

    prefs

    The preferences session.

    path

    The path.

    Return Value

    TRUE if successful; otherwise, FALSE.

    Availability

    Available in OS X v10.1 and later.