Skip to content

Commit

Permalink
explorer: Disable moving workspace roots in one another
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorn committed Aug 28, 2018
1 parent 1cdea4a commit f881f8c
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -871,15 +871,17 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop {
return true; // Can not move anything onto itself
}

// If we are not moving workspace root folders
if (!(source.isRoot && target instanceof ExplorerItem && target.isRoot)) {
if (!isCopy && resources.dirname(source.resource).toString() === target.resource.toString()) {
return true; // Can not move a file to the same parent unless we copy
}
if (source.isRoot && target instanceof ExplorerItem && target.isRoot) {
// Disable moving workspace roots in one another
return false;
}

if (resources.isEqualOrParent(target.resource, source.resource, !isLinux /* ignorecase */)) {
return true; // Can not move a parent folder into one of its children
}
if (!isCopy && resources.dirname(source.resource).toString() === target.resource.toString()) {
return true; // Can not move a file to the same parent unless we copy
}

if (resources.isEqualOrParent(target.resource, source.resource, !isLinux /* ignorecase */)) {
return true; // Can not move a parent folder into one of its children
}

return false;
Expand Down

0 comments on commit f881f8c

Please sign in to comment.