Skip to content

Commit 78478e2

Browse files
committed
Correct use of NSURLConnectionDelegate methods
1 parent e951a40 commit 78478e2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cocos2d/CCPackageDownload.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#import "CCPackageConstants.h"
77
#import "ccMacros.h"
88
#import "CCPackage_private.h"
9+
#import "CCFileUtils.h"
910

1011
@interface CCPackageDownload()
1112

@@ -322,8 +323,6 @@ - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLRespon
322323
if (_fileSize == _totalBytes)
323324
{
324325
CCLOGINFO(@"[PACKAGE/DOWNLOAD][INFO] Download already finished. Stopping download request.");
325-
[self connectionDidFinishLoading:_connection];
326-
[self closeConnectionAndFileHandle];
327326
}
328327
else if (_fileSize > _totalBytes)
329328
{
@@ -339,8 +338,9 @@ - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLRespon
339338

340339
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
341340
{
341+
[self closeConnectionAndFileHandle];
342342
NSError *error;
343-
if (![[NSFileManager defaultManager] moveItemAtURL:[NSURL fileURLWithPath:_tempPath] toURL:_localURL error:&error])
343+
if (![[[CCFileUtils sharedFileUtils] fileManager] moveItemAtURL:[NSURL fileURLWithPath:_tempPath] toURL:_localURL error:&error])
344344
{
345345
[self connection:connection didFailWithError:error];
346346
return;

0 commit comments

Comments
 (0)