diff --git a/plugin.xml b/plugin.xml index 90ff927d4..9d4f7e732 100644 --- a/plugin.xml +++ b/plugin.xml @@ -30,7 +30,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" https://issues.apache.org/jira/browse/CB/component/12320651 - + diff --git a/src/android/FileUtils.java b/src/android/FileUtils.java index 1d6e61fa3..2fa180c02 100644 --- a/src/android/FileUtils.java +++ b/src/android/FileUtils.java @@ -992,6 +992,8 @@ private JSONObject requestAllPaths() throws JSONException { ret.put("applicationStorageDirectory", toDirUrl(context.getFilesDir().getParentFile())); ret.put("dataDirectory", toDirUrl(context.getFilesDir())); ret.put("cacheDirectory", toDirUrl(context.getCacheDir())); + // databasepath + ret.put("databaseDirectory", toDirUrl(context.getDatabasePath("dummy").getParentFile())); if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { try { ret.put("externalApplicationStorageDirectory", toDirUrl(context.getExternalFilesDir(null).getParentFile())); diff --git a/src/windows/FileProxy.js b/src/windows/FileProxy.js index d829d7755..fdb13f496 100644 --- a/src/windows/FileProxy.js +++ b/src/windows/FileProxy.js @@ -181,6 +181,30 @@ var windowsPaths = { applicationStorageDirectory: 'ms-appx:///' }; +if (Windows.Storage.UserDataPaths) { + var userDataPaths = null; + if (typeof Windows.Storage.UserDataPaths.getDefault === 'function') { + userDataPaths = Windows.Storage.UserDataPaths.getDefault(); + } + if (!userDataPaths && typeof Windows.Storage.UserDataPaths.getForUser === 'function') { + userDataPaths = Windows.Storage.UserDataPaths.getForUser(); + } + if (userDataPaths) { + if (userDataPaths.documents) { + windowsPaths.documentsDirectory = 'file:///' + nativePathToCordova(userDataPaths.documents); + } + if (userDataPaths.music) { + windowsPaths.musicDirectory = 'file:///' + nativePathToCordova(userDataPaths.music); + } + if (userDataPaths.pictures) { + windowsPaths.picturesDirectory = 'file:///' + nativePathToCordova(userDataPaths.pictures); + } + if (userDataPaths.videos) { + windowsPaths.videosDirectory = 'file:///' + nativePathToCordova(userDataPaths.videos); + } + } +} + var AllFileSystems; function getAllFS () { diff --git a/www/fileSystemPaths.js b/www/fileSystemPaths.js index f79794bb0..81ad54fb0 100644 --- a/www/fileSystemPaths.js +++ b/www/fileSystemPaths.js @@ -45,9 +45,16 @@ exports.file = { // iOS: Holds app-specific files that should be synced (e.g. to iCloud). syncedDataDirectory: null, // iOS: Files private to the app, but that are meaningful to other applications (e.g. Office files) + // Windows: Gets the path to a user's Documents folder. documentsDirectory: null, // BlackBerry10: Files globally available to all apps - sharedDirectory: null + sharedDirectory: null, + // Windows: Gets the path to a user's Music folder. + musicDirectory: null, + // Windows: Gets the path to a user's Pictures folder. + picturesDirectory: null, + // Windows: Gets the path to a user's Videos folder. + videoDirectory: null }; channel.waitForInitialization('onFileSystemPathsReady'); diff --git a/www/resolveLocalFileSystemURI.js b/www/resolveLocalFileSystemURI.js index 764662c04..cc88ff7ea 100644 --- a/www/resolveLocalFileSystemURI.js +++ b/www/resolveLocalFileSystemURI.js @@ -54,7 +54,8 @@ }; // sanity check for 'not:valid:filename' or '/not:valid:filename' // file.spec.12 window.resolveLocalFileSystemURI should error (ENCODING_ERR) when resolving invalid URI with leading /. - if (!uri || uri.split(':').length > 2) { + // now, better no check than bad check! + if (!uri) { setTimeout(function () { fail(FileError.ENCODING_ERR); }, 0);