A user hit an issue on an iPhone 5s. Device transfer would fail because their app group was missing the ProfileAvatars directory. This directory is lazily created as a post-launch job at background QoS. It's not too big of a deal and it'll be created on demand if necessary. The 5s was probably CPU constrained enough to never have a chance to run any background jobs. The fix is to just have our recursive filesystem traversal ignore any unknown directory errors. This is only used in a couple places and the behavior makes sense in each place.
54 lines
1.6 KiB
Objective-C
54 lines
1.6 KiB
Objective-C
//
|
|
// Copyright (c) 2020 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
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);
|
|
|
|
@interface OWSFileSystem : NSObject
|
|
|
|
+ (instancetype)new NS_UNAVAILABLE;
|
|
- (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;
|
|
|
|
+ (BOOL)moveFilePath:(NSString *)oldFilePath toFilePath:(NSString *)newFilePath;
|
|
|
|
// Returns NO IFF the directory does not exist and could not be created.
|
|
+ (BOOL)ensureDirectoryExists:(NSString *)dirPath;
|
|
|
|
+ (BOOL)ensureFileExists:(NSString *)filePath;
|
|
|
|
+ (void)deleteContentsOfDirectory:(NSString *)dirPath;
|
|
|
|
+ (nullable NSNumber *)fileSizeOfPath:(NSString *)filePath;
|
|
|
|
+ (nullable NSNumber *)fileSizeOfUrl:(NSURL *)fileUrl;
|
|
|
|
+ (void)logAttributesOfItemAtPathRecursively:(NSString *)path;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|