Fix Path Issue for CopyDbToStorage Function

This commit is contained in:
Rahul Pandey
2017-03-08 13:45:32 +05:30
committed by GitHub
parent 5e3e3263bd
commit a3f362ba03
+7 -6
View File
@@ -158,16 +158,17 @@ public class sqlDB extends CordovaPlugin {
private void copyDbToStorage(String dbname, String dest, final CallbackContext callbackContext){
File source = cordova.getActivity().getDatabasePath(dbname);
File destination;
File destFolder;
File destination;
if(dest.indexOf("file://") != -1){
destination = new File(dest.replace("file://",""));
destination = new File(dest.replace("file://","") + dbname);
} else {
destination = new File(dest);
destination = new File(dest + dbname);
}
if(!destination.exists()){
destination.mkdirs();
if(!destFolder.exists()){
destFolder.mkdirs();
}
if(source.exists()) {
this.newCopyDB(source,destination,callbackContext);
} else {