Copy files to a shared folder instead of moving them

This commit is contained in:
yflory
2019-01-07 10:25:13 +01:00
parent 0a7adb3e88
commit 047a4a3ab4
2 changed files with 23 additions and 11 deletions

View File

@@ -281,6 +281,10 @@ define([
var resolved = _resolvePaths(Env, data.paths);
var newResolved = _resolvePath(Env, data.newPath);
// NOTE: we can only copy when moving from one drive to another. We don't want
// duplicates in the same drive
var copy = data.copy;
if (!newResolved.userObject.isFolder(newResolved.path)) { return void cb(); }
nThen(function (waitFor) {
@@ -305,6 +309,8 @@ define([
Array.prototype.push.apply(ownedPads, _owned);
});
if (copy) { return; }
if (resolved.main.length) {
var rootPath = resolved.main[0].slice();
rootPath.pop();
@@ -338,6 +344,8 @@ define([
uoTo.copyFromOtherDrive(newResolved.path, obj.el, obj.data, obj.key);
});
if (copy) { return; }
// Remove the elements from the old location (without unpinning)
uoFrom.delete(paths, waitFor());
}
@@ -791,12 +799,13 @@ define([
}
}, cb);
};
var moveInner = function (Env, paths, newPath, cb) {
var moveInner = function (Env, paths, newPath, cb, copy) {
return void Env.sframeChan.query("Q_DRIVE_USEROBJECT", {
cmd: "move",
data: {
paths: paths,
newPath: newPath
newPath: newPath,
copy: copy
}
}, cb);
};