cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject [2/5] git commit: ios Fixes
Date Wed, 19 Feb 2014 17:36:25 GMT
ios Fixes


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

Branch: refs/heads/file-extras-rewrite
Commit: 2ca87bc407bf153c38c7c9262d1bc41ea4dd387d
Parents: a1ff8d8
Author: Ian Clelland <iclelland@chromium.org>
Authored: Mon Feb 17 22:10:58 2014 -0500
Committer: Ian Clelland <iclelland@chromium.org>
Committed: Wed Feb 19 12:34:14 2014 -0500

----------------------------------------------------------------------
 file-system-roots/ios/FileSystemRoots.m | 40 ++++++++++++----------------
 1 file changed, 17 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/2ca87bc4/file-system-roots/ios/FileSystemRoots.m
----------------------------------------------------------------------
diff --git a/file-system-roots/ios/FileSystemRoots.m b/file-system-roots/ios/FileSystemRoots.m
index d6bb469..b9b4f22 100644
--- a/file-system-roots/ios/FileSystemRoots.m
+++ b/file-system-roots/ios/FileSystemRoots.m
@@ -39,32 +39,26 @@ typedef int FileSystemPurpose;
 
 @implementation FileSystemRoots
 
-- (id)initWithWebView:(UIWebView*)theWebView
-{
-    self = [super initWithWebView:theWebView];
-    if (self) {
-        NSString *libPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask,
YES) objectAtIndex:0];
-        NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,
YES) objectAtIndex:0];
-        availableFilesystems = @{
-            @"library": libPath,
-            @"library-nosync": [libPath stringByAppendingPathComponent:@"NoCloud"],
-            @"documents": docPath,
-            @"documents-nosync": [docPath stringByAppendingPathComponent:@"NoCloud"],
-            @"cache": [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask,
YES) objectAtIndex:0],
-            @"bundle": [[NSBundle mainBundle] bundlePath],
-            @"root": @"/"
-        };
-        installedFilesystems = [[NSMutableSet alloc] initWithCapacity:7];
-    }
-    return self;
-}
-
 - (void)pluginInitialize
 {
+    NSString *libPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask,
YES) objectAtIndex:0];
+    NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,
YES) objectAtIndex:0];
+    availableFilesystems = @{
+        @"library": libPath,
+        @"library-nosync": [libPath stringByAppendingPathComponent:@"NoCloud"],
+        @"documents": docPath,
+        @"documents-nosync": [docPath stringByAppendingPathComponent:@"NoCloud"],
+        @"cache": [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask,
YES) objectAtIndex:0],
+        @"bundle": [[NSBundle mainBundle] bundlePath],
+        @"root": @"/"
+    };
+    installedFilesystems = [[NSMutableSet alloc] initWithCapacity:7];
+
+    /* Get filesystems to be installed from settings */
     id vc = self.viewController;
     
     NSDictionary *settings = [vc settings];
-    NSString *filesystemsStr = [[settings objectForKey:@"iosextrafilesystems"] lowercaseString];
+    NSString *filesystemsStr = [settings[@"iosextrafilesystems"] lowercaseString];
     if (!filesystemsStr) {
         filesystemsStr = @"library,library-nosync,documents,documents-nosync,cache,bundle";
     }
@@ -73,7 +67,7 @@ typedef int FileSystemPurpose;
     /* Build non-syncable directories as necessary */
     for (NSString *nonSyncFS in @[@"library-nosync", @"documents-nosync"]) {
         if ([filesystems containsObject:nonSyncFS]) {
-            [self makeNonSyncable:[availableFilesystems objectForKey:nonSyncFS]];
+            [self makeNonSyncable:availableFilesystems[nonSyncFS]];
         }
     }
     
@@ -82,7 +76,7 @@ typedef int FileSystemPurpose;
         /* Register filesystems in order */
         for (NSString *fsName in filesystems) {
             if (![installedFilesystems containsObject:fsName]) {
-                NSString *fsRoot = [availableFilesystems objectForKey:fsName];
+                NSString *fsRoot = availableFilesystems[fsName];
                 if (fsRoot) {
                     [filePlugin registerFilesystem:[[CDVLocalFilesystem alloc] initWithName:fsName
root:fsRoot]];
                     [installedFilesystems addObject:fsName];


Mime
View raw message