/ CoreFoundation / Base.subproj / CFKnownLocations.h
CFKnownLocations.h
 1  /*	CFKnownLocations.h
 2  	Copyright (c) 1999-2017, Apple Inc. and the Swift project authors
 3   
 4  	Portions Copyright (c) 2014-2017, Apple Inc. and the Swift project authors
 5  	Licensed under Apache License v2.0 with Runtime Library Exception
 6  	See http://swift.org/LICENSE.txt for license information
 7  	See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
 8  */
 9  
10  #if !defined(__COREFOUNDATION_CFKNOWNLOCATIONS__)
11  #define __COREFOUNDATION_CFKNOWNLOCATIONS__ 1
12  
13  #include <CoreFoundation/CFBase.h>
14  #include <CoreFoundation/CFURL.h>
15  
16  CF_ASSUME_NONNULL_BEGIN
17  
18  typedef CF_ENUM(CFIndex, CFKnownLocationUser) {
19      _kCFKnownLocationUserAny,
20      _kCFKnownLocationUserCurrent,
21      _kCFKnownLocationUserByName,
22  };
23  
24  /* A note on support:
25   
26   - We document that CFPreferences… can only take AnyUser or CurrentUser as users.
27   - The code we shipped so far accepted the name of any one user on the current system as an alternative, but:
28   - For platforms that use the XDG spec to identify a configuration path in a user's home, we cannot determine that path for any user other than the one we're currently running as.
29   
30   So:
31    - We're keeping that behavior when building Core Foundation for Darwin/ObjC for compatibility, hence the _EXTENSIBLE above; on those platforms, the …ByName enum will continue working to get locations for arbitrary usernames. But:
32    - For Swift and any new platform, we are enforcing the documented constraint. Using a user value other than …Any or …Current above will assert (or return NULL if asserts are off).
33   
34   See CFKnownLocations.c for a summary of what paths are returned.
35   */
36  
37  // The username parameter is ignored for any user constant other than …ByName. …ByName with a NULL username is the same as …Current.
38  extern CFURLRef _Nullable _CFKnownLocationCreatePreferencesURLForUser(CFKnownLocationUser user, CFStringRef _Nullable username);
39  
40  CF_ASSUME_NONNULL_END
41  
42  #endif /* __COREFOUNDATION_CFKNOWNLOCATIONS__ */