Parcourir la source

Download Controller: add cancelation support for FTP

Felix Paul Kühne il y a 12 ans
Parent
commit
d21f989f48
1 fichiers modifiés avec 11 ajouts et 0 suppressions
  1. 11 0
      AspenProject/VLCDownloadViewController.m

+ 11 - 0
AspenProject/VLCDownloadViewController.m

@@ -125,6 +125,17 @@
     if (_currentDownloadType == kVLCDownloadViaHTTP) {
         if (_httpDownloader.downloadInProgress)
             [_httpDownloader cancelDownload];
+    } else if (_currentDownloadType == kVLCDownloadViaFTP) {
+        if (_FTPDownloadRequest) {
+            NSURL *target = _FTPDownloadRequest.downloadLocation;
+            [_FTPDownloadRequest destroy];
+            [self requestCompleted:_FTPDownloadRequest];
+
+            /* remove partially downloaded content */
+            NSFileManager *fileManager = [NSFileManager defaultManager];
+            if ([fileManager fileExistsAtPath:target.path])
+                [fileManager removeItemAtPath:target.path error:nil];
+        }
     }
 }