Don't back up profile pics, attachments or gifs.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent f7c2cf0f2e
commit d7b0424c75

@ -1408,6 +1408,16 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
DDLogError(@"Failed to create profile avatars directory: %@", error); DDLogError(@"Failed to create profile avatars directory: %@", error);
} }
} }
NSURL *dirURL = [NSURL fileURLWithPath:profileAvatarsDirPath];
NSError *error = nil;
[dirURL setResourceValues:@{
NSURLIsExcludedFromBackupKey : @(YES),
}
error:&error];
if (error) {
OWSFail(@"Failed to exclude profile avatars directory from backup: %@", error);
}
}); });
return profileAvatarsDirPath; return profileAvatarsDirPath;
} }

@ -842,6 +842,12 @@ extension URLSessionTask {
attributes:nil) attributes:nil)
gifFolderPath = dirPath gifFolderPath = dirPath
} }
// Don't back up Giphy downloads.
var dirURL = NSURL.fileURL(withPath:dirPath)
var resourceValues = URLResourceValues()
resourceValues.isExcludedFromBackup = true
try dirURL.setResourceValues(resourceValues)
} catch let error as NSError { } catch let error as NSError {
owsFail("\(GiphyAsset.TAG) ensureTempFolder failed: \(dirPath), \(error)") owsFail("\(GiphyAsset.TAG) ensureTempFolder failed: \(dirPath), \(error)")
gifFolderPath = tempDirPath gifFolderPath = tempDirPath

@ -204,6 +204,16 @@ NS_ASSUME_NONNULL_BEGIN
DDLogError(@"Failed to create attachments directory: %@", error); DDLogError(@"Failed to create attachments directory: %@", error);
} }
} }
NSURL *dirURL = [NSURL fileURLWithPath:attachmentsFolder];
NSError *error = nil;
[dirURL setResourceValues:@{
NSURLIsExcludedFromBackupKey : @(YES),
}
error:&error];
if (error) {
OWSFail(@"Failed to exclude attachments directory from backup: %@", error);
}
}); });
return attachmentsFolder; return attachmentsFolder;
} }

Loading…
Cancel
Save