Commit 75115229 authored by Benjamin Fischer's avatar Benjamin Fischer
Browse files

[remote] filesystem: paste will acutally use move if it can and should

parent 05901dd4
...@@ -414,27 +414,25 @@ class FileSystem(object): ...@@ -414,27 +414,25 @@ class FileSystem(object):
archive.extractall(dstdir) archive.extractall(dstdir)
def paste(self, path, fullsrc, cut): def paste(self, path, fullsrc, cut):
path = self.expand(path)
if isinstance(fullsrc, (list, tuple)): if isinstance(fullsrc, (list, tuple)):
for p in fullsrc: for p in fullsrc:
p = self.expand(p)
self.paste(path, p, cut) self.paste(path, p, cut)
return True return True
# fulltarget = os.path.join(path, fullsrc.split(os.sep)[-1]) path = self.expand(path)
target = self.handle_file_name_collision( fullsrc = self.expand(fullsrc)
fullsrc.split(os.sep)[-1], path) srcdir, srcname = os.path.split(fullsrc)
target = self.handle_file_name_collision(srcname, path)
fulltarget = os.path.join(path, target) fulltarget = os.path.join(path, target)
if os.path.isdir(fullsrc): if cut and self.checkPermissions(srcdir):
shutil.copytree(fullsrc, fulltarget, symlinks=True) shutil.move(fullsrc, fulltarget)
if cut:
else: else:
shutil.copy2(fullsrc, fulltarget) if os.path.isdir(fullsrc):
if cut: shutil.copytree(fullsrc, fulltarget, symlinks=True)
os.remove(fullsrc) else:
shutil.copy2(fullsrc, fulltarget)
def save_file(self, path, content, force=True, binary=False, def save_file(self, path, content, force=True, binary=False,
utf8=False, window_id=None, view_id=None, watch_id=None): utf8=False, window_id=None, view_id=None, watch_id=None):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment