]> Savannah Git Hosting - gnulib.git/commitdiff
vfs: use absolute paths during backup
authorDmitry Selyutin <ghostmansd@gmail.com>
Fri, 1 Dec 2017 21:45:06 +0000 (00:45 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Fri, 1 Dec 2017 21:45:06 +0000 (00:45 +0300)
pygnulib/vfs.py

index f3cbd46fc2b8d191495c05a6f9279fb785715293..8403257fcf7513010914fddaac08208ce1e0bbf4 100644 (file)
@@ -137,7 +137,7 @@ def mkdir(root, name):
 def backup(root, name):
     """Backup the given file."""
     root = Base(".") if root is None else root
-    path = _os.path.join(root.relative, root[name])
+    path = _os.path.join(root.absolute, root[name])
     backup = "{}~".format(path)
     try:
         _os.unlink(backup)
@@ -241,6 +241,7 @@ def symlink(src_root, src_name, dst_root, dst_name, relative=True):
         dst_path = _os.path.join(dst_root.absolute, dst_root[dst_name])
     _os.symlink(src_path, dst_path)
 
+
 def unlink(root, name, backup=True):
     """Unlink a file, backing it up if necessary."""
     root = Base(".") if root is None else root