mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.7 KiB
C
56 lines
1.7 KiB
C
5 years ago
|
#import <Foundation/Foundation.h>
|
||
|
|
||
|
NS_ASSUME_NONNULL_BEGIN
|
||
|
|
||
|
// Use instead of NSTemporaryDirectory()
|
||
|
// prefer the more restrictice OWSTemporaryDirectory,
|
||
|
// unless the temp data may need to be accessed while the device is locked.
|
||
|
NSString *OWSTemporaryDirectory(void);
|
||
|
NSString *OWSTemporaryDirectoryAccessibleAfterFirstAuth(void);
|
||
|
void ClearOldTemporaryDirectories(void);
|
||
4 years ago
|
void ClearOldTemporaryDirectoriesSync(void);
|
||
5 years ago
|
|
||
|
@interface OWSFileSystem : NSObject
|
||
|
|
||
|
- (instancetype)init NS_UNAVAILABLE;
|
||
|
|
||
|
+ (BOOL)protectFileOrFolderAtPath:(NSString *)path;
|
||
|
+ (BOOL)protectFileOrFolderAtPath:(NSString *)path fileProtectionType:(NSFileProtectionType)fileProtectionType;
|
||
|
|
||
|
+ (BOOL)protectRecursiveContentsAtPath:(NSString *)path;
|
||
|
|
||
|
+ (NSString *)appDocumentDirectoryPath;
|
||
|
|
||
|
+ (NSString *)appLibraryDirectoryPath;
|
||
|
|
||
|
+ (NSString *)appSharedDataDirectoryPath;
|
||
|
|
||
|
+ (NSString *)cachesDirectoryPath;
|
||
|
|
||
|
+ (nullable NSError *)renameFilePathUsingRandomExtension:(NSString *)oldFilePath;
|
||
|
|
||
|
+ (nullable NSError *)moveAppFilePath:(NSString *)oldFilePath sharedDataFilePath:(NSString *)newFilePath;
|
||
|
|
||
|
// Returns NO IFF the directory does not exist and could not be created.
|
||
|
+ (BOOL)ensureDirectoryExists:(NSString *)dirPath;
|
||
|
|
||
|
+ (BOOL)ensureFileExists:(NSString *)filePath;
|
||
|
|
||
|
+ (BOOL)deleteFile:(NSString *)filePath;
|
||
|
|
||
|
+ (BOOL)deleteFileIfExists:(NSString *)filePath;
|
||
|
|
||
|
+ (NSArray<NSString *> *_Nullable)allFilesInDirectoryRecursive:(NSString *)dirPath error:(NSError **)error;
|
||
|
|
||
|
+ (NSString *)temporaryFilePath;
|
||
|
+ (NSString *)temporaryFilePathWithFileExtension:(NSString *_Nullable)fileExtension;
|
||
|
|
||
|
// Returns nil on failure.
|
||
|
+ (nullable NSString *)writeDataToTemporaryFile:(NSData *)data fileExtension:(NSString *_Nullable)fileExtension;
|
||
|
|
||
|
+ (nullable NSNumber *)fileSizeOfPath:(NSString *)filePath;
|
||
|
|
||
|
@end
|
||
|
|
||
|
NS_ASSUME_NONNULL_END
|