cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject ios commit: [CB-2911] Updated resolveLocalFileSystemURI.
Date Mon, 15 Apr 2013 16:55:49 GMT
Updated Branches:
  refs/heads/master 5e8e2697e -> d7fb7bf38


[CB-2911] Updated resolveLocalFileSystemURI.

It now supports assets-library:// URIs.


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/d7fb7bf3
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/d7fb7bf3
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/d7fb7bf3

Branch: refs/heads/master
Commit: d7fb7bf3889afd75152423e8c6a493d5dae38e5d
Parents: 5e8e269
Author: Max Woghiren <max.woghiren@gmail.com>
Authored: Mon Apr 8 11:48:11 2013 -0400
Committer: Max Woghiren <max.woghiren@gmail.com>
Committed: Mon Apr 15 12:54:21 2013 -0400

----------------------------------------------------------------------
 CordovaLib/Classes/CDVFile.m |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/d7fb7bf3/CordovaLib/Classes/CDVFile.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVFile.m b/CordovaLib/Classes/CDVFile.m
index 8c65270..10908ce 100644
--- a/CordovaLib/Classes/CDVFile.m
+++ b/CordovaLib/Classes/CDVFile.m
@@ -227,10 +227,9 @@ NSString* const kCDVAssetsLibraryPrefix = @"assets-library://";
     NSURL* testUri = [NSURL URLWithString:strUri];
     CDVPluginResult* result = nil;
 
-    if (!testUri || ![testUri isFileURL]) {
-        // issue ENCODING_ERR
+    if (!testUri) {
         result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:ENCODING_ERR];
-    } else {
+    } else if ([testUri isFileURL]) {
         NSFileManager* fileMgr = [[NSFileManager alloc] init];
         NSString* path = [testUri path];
         // NSLog(@"url path: %@", path);
@@ -262,7 +261,13 @@ NSString* const kCDVAssetsLibraryPrefix = @"assets-library://";
             // return NOT_FOUND_ERR
             result = [CDVPluginResult resultWithStatus:CDVCommandStatus_IO_EXCEPTION messageAsInt:NOT_FOUND_ERR];
         }
+    } else if ([strUri hasPrefix:@"assets-library://"]) {
+        NSDictionary* fileSystem = [self getDirectoryEntry:strUri isDirectory:NO];
+        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:fileSystem];
+    } else {
+        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:ENCODING_ERR];
     }
+
     if (result != nil) {
         [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
     }


Mime
View raw message