Improve handling of thumbnails dir.
This commit is contained in:
parent
3a5d1877da
commit
72a71c185b
@ -107,7 +107,6 @@ typedef void (^OWSThumbnailFailure)(void);
|
||||
// Marks attachment as having completed "lazy backup restore."
|
||||
- (void)updateWithLazyRestoreComplete;
|
||||
|
||||
// TODO: Review.
|
||||
- (nullable TSAttachmentStream *)cloneAsThumbnail;
|
||||
|
||||
#pragma mark - Protobuf
|
||||
|
||||
@ -734,15 +734,17 @@ typedef void (^OWSLoadedThumbnailSuccess)(OWSLoadedThumbnail *loadedThumbnail);
|
||||
NSMutableArray<NSString *> *result = [NSMutableArray new];
|
||||
|
||||
NSString *thumbnailsDirPath = self.thumbnailsDirPath;
|
||||
NSError *error;
|
||||
NSArray<NSString *> *_Nullable fileNames =
|
||||
[[NSFileManager defaultManager] contentsOfDirectoryAtPath:thumbnailsDirPath error:&error];
|
||||
if (error || !fileNames) {
|
||||
OWSFail(@"contentsOfDirectoryAtPath failed with error: %@", error);
|
||||
} else {
|
||||
for (NSString *fileName in fileNames) {
|
||||
NSString *filePath = [thumbnailsDirPath stringByAppendingPathComponent:fileName];
|
||||
[result addObject:filePath];
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:thumbnailsDirPath]) {
|
||||
NSError *error;
|
||||
NSArray<NSString *> *_Nullable fileNames =
|
||||
[[NSFileManager defaultManager] contentsOfDirectoryAtPath:thumbnailsDirPath error:&error];
|
||||
if (error || !fileNames) {
|
||||
OWSFail(@"contentsOfDirectoryAtPath failed with error: %@", error);
|
||||
} else {
|
||||
for (NSString *fileName in fileNames) {
|
||||
NSString *filePath = [thumbnailsDirPath stringByAppendingPathComponent:fileName];
|
||||
[result addObject:filePath];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user