Mercurial > gnulib
changeset 39072:0a4e009dbf98
vfs: use absolute paths during backup
author | Dmitry Selyutin <ghostmansd@gmail.com> |
---|---|
date | Sat, 02 Dec 2017 00:45:06 +0300 |
parents | 9485d297ac3d |
children | 2ed39bfde476 |
files | pygnulib/vfs.py |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/pygnulib/vfs.py Sat Dec 02 00:42:30 2017 +0300 +++ b/pygnulib/vfs.py Sat Dec 02 00:45:06 2017 +0300 @@ -137,7 +137,7 @@ 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 @@ 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