فهرست منبع

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"];