瀏覽代碼

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