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):
archive.extractall(dstdir)
def paste(self, path, fullsrc, cut):
# TODO
path = self.expand(path)
if isinstance(fullsrc, (list, tuple)):
for p in fullsrc:
p = self.expand(p)
self.paste(path, p, cut)
return True
# fulltarget = os.path.join(path, fullsrc.split(os.sep)[-1])
target = self.handle_file_name_collision(
fullsrc.split(os.sep)[-1], path)
path = self.expand(path)
fullsrc = self.expand(fullsrc)
srcdir, srcname = os.path.split(fullsrc)
target = self.handle_file_name_collision(srcname, path)
fulltarget = os.path.join(path, target)
if os.path.isdir(fullsrc):
shutil.copytree(fullsrc, fulltarget, symlinks=True)
if cut:
shutil.rmtree(fullsrc)
if cut and self.checkPermissions(srcdir):
shutil.move(fullsrc, fulltarget)
else:
shutil.copy2(fullsrc, fulltarget)
if cut:
os.remove(fullsrc)
if os.path.isdir(fullsrc):
shutil.copytree(fullsrc, fulltarget, symlinks=True)
else:
shutil.copy2(fullsrc, fulltarget)
def save_file(self, path, content, force=True, binary=False,
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