Преглед на файлове

http file downloader: remove partially downloaded content if user cancels the process

Felix Paul Kühne преди 12 години
родител
ревизия
a1200ef7c8
променени са 1 файла, в които са добавени 6 реда и са изтрити 0 реда
  1. 6 0
      AspenProject/VLCHTTPFileDownloader.m

+ 6 - 0
AspenProject/VLCHTTPFileDownloader.m

@@ -113,6 +113,12 @@
 - (void)cancelDownload
 {
     [_urlConnection cancel];
+
+    /* remove partially downloaded content */
+    NSFileManager *fileManager = [NSFileManager defaultManager];
+    if ([fileManager fileExistsAtPath:_filePath])
+        [fileManager removeItemAtPath:_filePath error:nil];
+
     if ([self.delegate respondsToSelector:@selector(downloadFailedWithErrorDescription:)])
         [self.delegate downloadFailedWithErrorDescription:@"Download canceled by user"];