You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/12/05 17:30:16 UTC

ios commit: CB-5276 Add ability to load start page from a place other then the bundle folder

Updated Branches:
  refs/heads/master ad8680488 -> 2d2a247b0


CB-5276 Add ability to load start page from a place other then the bundle folder


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

Branch: refs/heads/master
Commit: 2d2a247b0c0e50393f497916e4c6317276fea386
Parents: ad86804
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Dec 5 11:29:53 2013 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Dec 5 11:29:53 2013 -0500

----------------------------------------------------------------------
 CordovaLib/Classes/CDVViewController.m | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/2d2a247b/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index ee11c4b..7eec134 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -215,10 +215,14 @@
             self.loadFromString = YES;
             appURL = nil;
         } else {
-            // CB-3005 we know that the page exists : reconstruct full path from bundle
-            NSURL* relativeURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]];
-            NSString* localURL = [NSString stringWithFormat:@"%@/%@", self.wwwFolderName, self.startPage];
-            appURL = [NSURL URLWithString:localURL relativeToURL:relativeURL];
+            appURL = [NSURL fileURLWithPath:startFilePath];
+            // CB-3005 Add on the query params or fragment.
+            NSString* startPageNoParentDirs = self.startPage;
+            NSRange r = [startPageNoParentDirs rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"?#"] options:0];
+            if (r.location != NSNotFound) {
+                NSString* queryAndOrFragment = [self.startPage substringFromIndex:r.location];
+                appURL = [NSURL URLWithString:queryAndOrFragment relativeToURL:appURL];
+            }
         }
     }