You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ia...@apache.org on 2014/08/26 17:17:52 UTC

git commit: CB-7375: CB-6148: Ensure that return values from copy and move operations reference the correct filesystem

Repository: cordova-plugin-file
Updated Branches:
  refs/heads/master 3086907f8 -> dd51229d9


CB-7375: CB-6148: Ensure that return values from copy and move operations reference the correct filesystem


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/dd51229d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/dd51229d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/dd51229d

Branch: refs/heads/master
Commit: dd51229d9bd1978e8e327396fb449a88b0f1b064
Parents: 3086907
Author: Ian Clelland <ic...@chromium.org>
Authored: Tue Aug 26 11:17:08 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Tue Aug 26 11:17:08 2014 -0400

----------------------------------------------------------------------
 www/Entry.js                     | 6 ++++--
 www/resolveLocalFileSystemURI.js | 4 +++-
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/dd51229d/www/Entry.js
----------------------------------------------------------------------
diff --git a/www/Entry.js b/www/Entry.js
index d41810b..952971d 100644
--- a/www/Entry.js
+++ b/www/Entry.js
@@ -117,7 +117,8 @@ Entry.prototype.moveTo = function(parent, newName, successCallback, errorCallbac
             if (entry) {
                 if (successCallback) {
                     // create appropriate Entry object
-                    var fs = (entry.filesystem && entry.filesystem.name) ? new FileSystem(entry.filesystem.name, { name: "", fullPath: "/" }) : filesystem;
+                    var newFSName = entry.filesystemName || (entry.filesystem && entry.filesystem.name);
+                    var fs = (newFSName && new FileSystem(newFSName, { name: "", fullPath: "/" }));
                     var result = (entry.isDirectory) ? new (require('./DirectoryEntry'))(entry.name, entry.fullPath, fs, entry.nativeURL) : new (require('org.apache.cordova.file.FileEntry'))(entry.name, entry.fullPath, fs, entry.nativeURL);
                     successCallback(result);
                 }
@@ -158,7 +159,8 @@ Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallbac
             if (entry) {
                 if (successCallback) {
                     // create appropriate Entry object
-                    var fs = (entry.filesystem && entry.filesystem.name) ? new FileSystem(entry.filesystem.name, { name: "", fullPath: "/" }) : filesystem;
+                    var newFSName = entry.filesystemName || (entry.filesystem && entry.filesystem.name);
+                    var fs = (newFSName && new FileSystem(newFSName, { name: "", fullPath: "/" }));
                     var result = (entry.isDirectory) ? new (require('./DirectoryEntry'))(entry.name, entry.fullPath, fs, entry.nativeURL) : new (require('org.apache.cordova.file.FileEntry'))(entry.name, entry.fullPath, fs, entry.nativeURL);
                     successCallback(result);
                 }

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/dd51229d/www/resolveLocalFileSystemURI.js
----------------------------------------------------------------------
diff --git a/www/resolveLocalFileSystemURI.js b/www/resolveLocalFileSystemURI.js
index 334748a..3d29ccb 100644
--- a/www/resolveLocalFileSystemURI.js
+++ b/www/resolveLocalFileSystemURI.js
@@ -51,7 +51,9 @@ module.exports.resolveLocalFileSystemURL = function(uri, successCallback, errorC
         if (entry) {
             if (successCallback) {
                 // create appropriate Entry object
-                var fsName = (entry.filesystem && entry.filesystem.name) || (entry.filesystem == window.PERSISTENT ? 'persistent' : 'temporary');
+                // The entry should have either a filesystemName property, or a filesystem property with a name
+                // For backwards compatibility, also accept window.PERSISTENT (0)
+                var fsName = entry.filesystemName || (entry.filesystem && entry.filesystem.name) || (entry.filesystem == window.PERSISTENT ? 'persistent' : 'temporary');
                 fileSystems.getFs(fsName, function(fs) {
                     if (!fs) {
                         fs = new FileSystem(fsName, {name:"", fullPath:"/"});