From 4e203372a88ed4285d907a49e1bdfbc5fb2563ec Mon Sep 17 00:00:00 2001 From: Thomas Vervest Date: Fri, 1 Apr 2011 05:34:08 -0700 Subject: [PATCH] Modified the way the Documents directory is retrieved. It now uses the main bundle resourcePath property, which results in the same directory, but a cleaner (and possibly more robust) way of finding it. --- Plugins/PixFileDownload.m | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Plugins/PixFileDownload.m b/Plugins/PixFileDownload.m index cc5c1e8..fe63b23 100644 --- a/Plugins/PixFileDownload.m +++ b/Plugins/PixFileDownload.m @@ -60,11 +60,7 @@ -(void) downloadFileFromUrlInBackgroundTask:(NSMutableArray*)paramArray NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSData* theData = [NSData dataWithContentsOfURL: [NSURL URLWithString:sourceUrl] ]; - // save file in documents directory - NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - NSString *documentsDirectory = [paths objectAtIndex:0]; - - NSString *newFilePath = [documentsDirectory stringByAppendingString:[NSString stringWithFormat: @"/%@", fileName]]; + NSString *newFilePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:fileName]; NSLog(@"Writing file to path %@", newFilePath); //NSFileManager *fileManager=[NSFileManager defaultManager];