From 62012bfacf7ca5f1770d123129f793c42b77beec Mon Sep 17 00:00:00 2001 From: Ryan Reed Date: Sat, 16 Sep 2023 23:04:21 -0400 Subject: [PATCH] Move existing source paths to backup even if symlink --- src/transpose/transpose.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/transpose/transpose.py b/src/transpose/transpose.py index e10b1fd..0948644 100644 --- a/src/transpose/transpose.py +++ b/src/transpose/transpose.py @@ -8,7 +8,7 @@ import json from . import version as transpose_version from .exceptions import TransposeError -from .utils import move, remove, symlink +from .utils import move, symlink @dataclass @@ -162,9 +162,7 @@ class Transpose: entry_path = Path(self.config.entries[name].path) if entry_path.exists(): - if entry_path.is_symlink(): - remove(entry_path) - elif force: # Backup the existing path + if force: # Backup the existing path move(entry_path, entry_path.with_suffix(".backup")) else: raise TransposeError( @@ -192,9 +190,7 @@ class Transpose: entry_path = Path(self.config.entries[name].path) if entry_path.exists(): - if entry_path.is_symlink(): - remove(entry_path) - elif force: # Backup the existing path + if force: # Backup the existing path move(entry_path, entry_path.with_suffix(".backup")) else: raise TransposeError(