SFDirectoryManager Class Reference
Inherits from | NSObject |
---|---|
Declared in | SFDirectoryManager.h |
Overview
Global directory manager that returns scoped directory. The scoping is enforced by taking into account the organizationId, the userId and the communityId.
The general structure follows this general template:
Other Methods
+ sharedManager
Returns the singleton of this manager
+ (instancetype)sharedManager
Declared In
SFDirectoryManager.h
+ ensureDirectoryExists:error:
Ensures the specified directory exists on the disk.
+ (BOOL)ensureDirectoryExists:(nullable NSString *)directory error:(NSError **)error
Parameters
directory |
The directory to ensure exists. |
---|---|
error |
The error on output or nil if no error is desired |
Return Value
YES if the directory exists or has been successfully created, NO otherwise.
Declared In
SFDirectoryManager.h
+ safeStringForDiskRepresentation:
Ensure the specified string contains only characters that can be safely used to identify a path on the disk.
+ (NSString *)safeStringForDiskRepresentation:(NSString *)candidate
Parameters
candidate |
The string to be checked for compatibility. |
---|
Declared In
SFDirectoryManager.h
– directoryForOrg:user:community:type:components:
Returns the path to the directory type for the specified org, user and community.
- (nullable NSString *)directoryForOrg:(nullable NSString *)orgId user:(nullable NSString *)userId community:(nullable NSString *)communityId type:(NSSearchPathDirectory)type components:(nullable NSArray *)components
Parameters
orgId |
The organization ID. If nil, this method returns the global directory type requested (eg Library/Caches) |
---|---|
userId |
The user ID. If nil, this method returns the directory type requested, scoped at the org level (eg Library/Caches/ |
communityId |
The community ID. If nil, this method returns the directory type requested, scoped at the user level (eg Library/Caches/ |
type |
The type of directory to return (see NSSearchPathDirectory) |
components |
The additional path components to be added at the end of the directory (eg [‘mybundle’, ‘common’]) |
Return Value
The path to the directory
Declared In
SFDirectoryManager.h
– directoryForUser:scope:type:components:
Returns the path to the directory type for the specified user and scope
- (nullable NSString *)directoryForUser:(SFUserAccount *)user scope:(SFUserAccountScope)scope type:(NSSearchPathDirectory)type components:(nullable NSArray *)components
Parameters
user |
The user account to use. If nil, the path returned corresponds to the global path type |
---|---|
scope |
The scope to use |
type |
The type of directory to return (see NSSearchPathDirectory) |
components |
The additional path components to be added at the end of the directory (eg [‘mybundle’, ‘common’]) |
Return Value
The path to the directory
Declared In
SFDirectoryManager.h
– directoryForUser:type:components:
Returns the path to the directory type for the specified user.
- (nullable NSString *)directoryForUser:(SFUserAccount *)account type:(NSSearchPathDirectory)type components:(nullable NSArray *)components
Parameters
account |
The user account to use. If nil, the path returned corresponds to the global path type |
---|---|
type |
The type of directory to return (see NSSearchPathDirectory) |
components |
The additional path components to be added at the end of the directory (eg [‘mybundle’, ‘common’]) |
Return Value
The path to the directory
Declared In
SFDirectoryManager.h
– directoryOfCurrentUserForType:components:
Returns the path to the directory type for the current user and current community.
- (nullable NSString *)directoryOfCurrentUserForType:(NSSearchPathDirectory)type components:(nullable NSArray *)components
Parameters
type |
The type of directory to return (see NSSearchPathDirectory) |
---|---|
components |
The additional path components to be added at the end of the directory (eg [‘mybundle’, ‘common’]) |
Return Value
The path to the directory
Declared In
SFDirectoryManager.h
– globalDirectoryOfType:components:
Returns the path to the global directory of the specified type. For example, NSCachesDirectory will
return “Library/Caches/
- (nullable NSString *)globalDirectoryOfType:(NSSearchPathDirectory)type components:(nullable NSArray *)components
Parameters
type |
The type of directory to return (see NSSearchPathDirectory) |
---|---|
components |
The additional path components to be added at the end of the directory (eg [‘mybundle’, ‘common’]) |
Return Value
The path to the directory
Declared In
SFDirectoryManager.h