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/03/03 22:31:56 UTC
git commit: CB-6148: Fix cross-filesystem copy and move
Repository: cordova-plugin-file
Updated Branches:
refs/heads/dev 1eff5cd46 -> 180948ed4
CB-6148: Fix cross-filesystem copy and move
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/180948ed
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/180948ed
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/180948ed
Branch: refs/heads/dev
Commit: 180948ed46ba9ded25edbef37aa807daaf80343d
Parents: 1eff5cd
Author: Ian Clelland <ic...@chromium.org>
Authored: Mon Mar 3 16:31:05 2014 -0500
Committer: Ian Clelland <ic...@chromium.org>
Committed: Mon Mar 3 16:31:05 2014 -0500
----------------------------------------------------------------------
src/ios/CDVLocalFilesystem.m | 2 +-
www/Entry.js | 10 ++++------
2 files changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/180948ed/src/ios/CDVLocalFilesystem.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVLocalFilesystem.m b/src/ios/CDVLocalFilesystem.m
index 5cad489..8c60da9 100644
--- a/src/ios/CDVLocalFilesystem.m
+++ b/src/ios/CDVLocalFilesystem.m
@@ -604,7 +604,7 @@
}
if (bSuccess) {
// should verify it is there and of the correct type???
- NSDictionary* newEntry = [self makeEntryForPath:newFullPath fileSystemName:srcURL.fileSystemName isDirectory:bSrcIsDir]; // should be the same type as source
+ NSDictionary* newEntry = [self makeEntryForPath:newFullPath fileSystemName:destURL.fileSystemName isDirectory:bSrcIsDir];
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:newEntry];
} else {
if (error) {
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/180948ed/www/Entry.js
----------------------------------------------------------------------
diff --git a/www/Entry.js b/www/Entry.js
index c3e4312..b025334 100644
--- a/www/Entry.js
+++ b/www/Entry.js
@@ -106,15 +106,14 @@ Entry.prototype.moveTo = function(parent, newName, successCallback, errorCallbac
var fail = errorCallback && function(code) {
errorCallback(new FileError(code));
};
- var fs = this.filesystem, // Copy / move op cannot cross filesystems;
- // source path
- srcURL = this.filesystem.__format__(this.fullPath),
+ var srcURL = this.filesystem.__format__(this.fullPath),
// entry name
name = newName || this.name,
success = function(entry) {
if (entry) {
if (successCallback) {
// create appropriate Entry object
+ var fs = entry.filesystemName ? new FileSystem(entry.filesystemName, {name:"", fullPath:"/"}) : this.filesystem;
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);
}
@@ -146,9 +145,7 @@ Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallbac
var fail = errorCallback && function(code) {
errorCallback(new FileError(code));
};
- var fs = this.filesystem, // Copy / move op cannot cross filesystems;
- // source path
- srcURL = this.filesystem.__format__(this.fullPath),
+ var srcURL = this.filesystem.__format__(this.fullPath),
// entry name
name = newName || this.name,
// success callback
@@ -156,6 +153,7 @@ Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallbac
if (entry) {
if (successCallback) {
// create appropriate Entry object
+ var fs = entry.filesystemName ? new FileSystem(entry.filesystemName, {name:"", fullPath:"/"}) : this.filesystem;
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);
}