Commit c14da4e2 authored by Carola's avatar Carola Committed by Felix Paul Kühne

make commit 8b5912bef46c3e836689fd3b2870f44e2a540cb6 work with the new MediaLibrary

Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 4bb4d288
......@@ -293,12 +293,26 @@
fileURL = [NSURL fileURLWithPath:filePath];
[fileURL setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil];
} else {
BOOL isDirectory = NO;
BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:filePath isDirectory:&isDirectory];
// add folders
if (exists && isDirectory) {
[foundFiles addObjectsFromArray:[[NSFileManager defaultManager] contentsOfDirectoryAtPath:filePath error:nil]];
NSArray *files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:filePath error:nil];
for (NSString* file in files) {
NSString *fullFilePath = [directoryPath stringByAppendingPathComponent:file];
isDirectory = NO;
exists = [[NSFileManager defaultManager] fileExistsAtPath:fullFilePath isDirectory:&isDirectory];
//only add folders or files in folders
if ((exists && isDirectory) || ![filePath.lastPathComponent isEqualToString:@"Documents"]) {
NSString *folderpath = [filePath stringByReplacingOccurrencesOfString:directoryPath withString:@""];
if (![folderpath isEqualToString:@""]) {
folderpath = [folderpath stringByAppendingString:@"/"];
}
NSString *path = [folderpath stringByAppendingString:file];
[foundFiles addObject:path];
}
}
}
}
}
......
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