Commit 059685e9 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Exclude media files from backup (close #8631)

parent c74bffc2
......@@ -76,9 +76,14 @@
#endif
NSArray *foundFiles = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:directoryPath error:nil];
NSMutableArray *filePaths = [NSMutableArray arrayWithCapacity:[foundFiles count]];
NSURL *fileURL;
for (NSString *fileName in foundFiles) {
if ([fileName rangeOfString:@"\\.(3gp|3gp|3gp2|3gpp|amv|asf|avi|divx|dv|flv|f4v|gvi|gxf|m1v|m2p|m2t|m2ts|m2v|m4v|mkv|moov|mov|mp2v|mp4|mpeg|mpeg1|mpeg2|mpeg4|mpg|mpv|mt2s|mts|mxf|oga|ogm|ogv|ogx|spx|ps|qt|rm|rmvb|ts|tts|vob|webm|wm|wmv)$" options:NSRegularExpressionSearch|NSCaseInsensitiveSearch].length != 0) {
[filePaths addObject:[directoryPath stringByAppendingPathComponent:fileName]];
/* exclude media files from backup (QA1719) */
fileURL = [NSURL URLWithString:fileName];
[fileURL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:nil];
}
}
[[MLMediaLibrary sharedMediaLibrary] addFilePaths:filePaths];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment