From 0aa98ac2da6f8fcac6457d13eb45c86baedabc6d Mon Sep 17 00:00:00 2001 From: Simon MacDonald Date: Mon, 22 Oct 2012 13:50:16 -0400 Subject: [PATCH 1/2] CB-1697: openDatabase of Cordova for Android uses the wrong directory separator --- framework/src/org/apache/cordova/Storage.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/framework/src/org/apache/cordova/Storage.java b/framework/src/org/apache/cordova/Storage.java index c76c9e4e..5ec30688 100755 --- a/framework/src/org/apache/cordova/Storage.java +++ b/framework/src/org/apache/cordova/Storage.java @@ -137,7 +137,20 @@ public class Storage extends CordovaPlugin { this.path = this.cordova.getActivity().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath(); } - this.dbName = this.path + File.pathSeparator + db + ".db"; + this.dbName = this.path + File.separator + db + ".db"; + + /* + * What is all this nonsense? Well the separator was incorrect so the db was showing up in the wrong + * directory. This bit of code fixes that issue and moves the db to the correct directory. + */ + File oldDbFile = new File(this.path + File.pathSeparator + db + ".db"); + if (oldDbFile.exists()) { + File dbPath = new File(this.path); + File dbFile = new File(dbName); + dbPath.mkdirs(); + oldDbFile.renameTo(dbFile); + } + this.myDb = SQLiteDatabase.openOrCreateDatabase(this.dbName, null); } From 6a1e089b73c90becfd131417424aa3076e51d368 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Tue, 23 Oct 2012 13:15:44 -0400 Subject: [PATCH 2/2] Change useBrowserHistory to default to true (actually) Also logs a deprecation mession on start-up when it is set to false. Fixes issue: https://issues.apache.org/jira/browse/CB-1611 --- framework/src/org/apache/cordova/CordovaWebView.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java index 52ae6a99..e55d544f 100755 --- a/framework/src/org/apache/cordova/CordovaWebView.java +++ b/framework/src/org/apache/cordova/CordovaWebView.java @@ -731,11 +731,10 @@ public class CordovaWebView extends WebView { } // Init preferences - if ("false".equals(this.getProperty("useBrowserHistory", "false"))) { - this.useBrowserHistory = false; - } - else { - this.useBrowserHistory = true; + this.useBrowserHistory = !"false".equals(this.getProperty("useBrowserHistory", "true")); + if (!this.useBrowserHistory) { + // Deprecated in Cordova 2.2.0. + Log.w(TAG, "useBrowserHistory=false is deprecated. Use history.back() instead of navigator.app.backHistory()."); } if ("true".equals(this.getProperty("fullscreen", "false"))) {