Update CDVFile to new exec format.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/46ecf98c Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/46ecf98c Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/46ecf98c Branch: refs/heads/master Commit: 46ecf98c23110b427fc39c1c0e08a8b5d01367dd Parents: b4c70c2 Author: Andrew Grieve <agri...@chromium.org> Authored: Fri Aug 3 11:07:21 2012 -0400 Committer: Andrew Grieve <agri...@chromium.org> Committed: Fri Aug 3 11:16:59 2012 -0400 ---------------------------------------------------------------------- CordovaLib/Classes/CDVFile.m | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/46ecf98c/CordovaLib/Classes/CDVFile.m ---------------------------------------------------------------------- diff --git a/CordovaLib/Classes/CDVFile.m b/CordovaLib/Classes/CDVFile.m index 2246fab..b17a307 100644 --- a/CordovaLib/Classes/CDVFile.m +++ b/CordovaLib/Classes/CDVFile.m @@ -304,15 +304,21 @@ extern NSString * const NSURLIsExcludedFromBackupKey __attribute__((weak_import) { NSMutableArray* arguments = [NSMutableArray arrayWithArray:command.arguments]; NSMutableDictionary* options = nil; - // add getDir to options and call getFile() if ([arguments count] >= 3) { - options = [NSMutableDictionary dictionaryWithDictionary:[arguments objectAtIndex:2]]; - [arguments setObject:options atIndexedSubscript:2]; + options = [arguments objectAtIndex:2 withDefault:nil]; + } + // add getDir to options and call getFile() + if (options != nil) { + options = [NSMutableDictionary dictionaryWithDictionary:options]; } else { options = [NSMutableDictionary dictionaryWithCapacity:1]; - [arguments addObject:options]; } [options setObject:[NSNumber numberWithInt:1] forKey:@"getDir"]; + if ([arguments count] >= 3) { + [arguments replaceObjectAtIndex:2 withObject:options]; + } else { + [arguments addObject:options]; + } CDVInvokedUrlCommand* subCommand = [[CDVInvokedUrlCommand alloc] initWithArguments:arguments callbackId:command.callbackId