Skip to content

Commit 84ea94a

Browse files
committed
[CB-7375][Entry] get proper filesystem in Entry
When the native side it doesn't return any kind of value related directly with the fileSystem, it has to be recreated after a copy, however, it makes perfect sense that, when the entry for the copied or moved file if there's no value in entry.fileSystem, it takes the filesystem property from the parent directory that it has been moved to or copied to. So instead of return a null object or take the previous filesystem(origin) from whatever location it was copied from. It would be better take the parent filesystem name and recreate it.
1 parent 73a5173 commit 84ea94a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

www/Entry.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Entry.prototype.moveTo = function(parent, newName, successCallback, errorCallbac
118118
if (successCallback) {
119119
// create appropriate Entry object
120120
var newFSName = entry.filesystemName || (entry.filesystem && entry.filesystem.name);
121-
var fs = (newFSName && new FileSystem(newFSName, { name: "", fullPath: "/" }));
121+
var fs = newFSName ? new FileSystem(newFSName, { name: "", fullPath: "/" }) : new FileSystem(parent.filesystem.name, { name: "", fullPath: "/" });
122122
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);
123123
successCallback(result);
124124
}
@@ -160,7 +160,7 @@ Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallbac
160160
if (successCallback) {
161161
// create appropriate Entry object
162162
var newFSName = entry.filesystemName || (entry.filesystem && entry.filesystem.name);
163-
var fs = (newFSName && new FileSystem(newFSName, { name: "", fullPath: "/" }));
163+
var fs = newFSName ? new FileSystem(newFSName, { name: "", fullPath: "/" }) : new FileSystem(parent.filesystem.name, { name: "", fullPath: "/" });
164164
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);
165165
successCallback(result);
166166
}

0 commit comments

Comments
 (0)