Commit 3f2b4882 authored by Carola Nitz's avatar Carola Nitz

VLCDocumentPickerController:Don't check if the file exists since it's...

VLCDocumentPickerController:Don't check if the file exists since it's unreliable, in case of error we show the user the error
parent 2ab25788
Pipeline #233 passed with stage
in 0 seconds
......@@ -72,14 +72,20 @@
NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
NSString *filePath = [documentsPath stringByAppendingPathComponent:[url lastPathComponent]];
if (![fileManager fileExistsAtPath:filePath]) {
NSError *error = nil;
BOOL success = [fileManager moveItemAtPath:[url path] toPath:filePath error:&error];
if (success) {
[[VLCMediaFileDiscoverer sharedInstance] updateMediaList];
}
NSError *error = nil;
BOOL success = [fileManager moveItemAtPath:[url path] toPath:filePath error:&error];
if (!error) {
[[VLCMediaFileDiscoverer sharedInstance] updateMediaList];
} else {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"GDRIVE_ERROR_DOWNLOADING_FILE_TITLE", nil) message:error.description preferredStyle:UIAlertControllerStyleAlert];
UIViewController *rootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[rootVC dismissViewControllerAnimated:true completion:nil];
}];
[alert addAction:okAction];
[rootVC presentViewController:alert animated:true completion:nil];
}
}
@end
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