From bdbcce8c052fa03e612af3e470455982d7b78489 Mon Sep 17 00:00:00 2001 From: Sylvain Willy Date: Sat, 11 Apr 2020 01:50:37 +0200 Subject: [PATCH] Handle case when both always_copy and prefer_hardlink_to_copy are True --- tvnamer/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tvnamer/utils.py b/tvnamer/utils.py index 67bda9d..5b840d4 100644 --- a/tvnamer/utils.py +++ b/tvnamer/utils.py @@ -1042,7 +1042,7 @@ class Renamer(object): def __init__(self, filename): self.filename = os.path.abspath(filename) - def newPath(self, new_path = None, new_fullpath = None, force = False, always_copy = False, always_move = False, always_hardlink = False, leave_symlink = False, create_dirs = True, getPathPreview = False): + def newPath(self, new_path = None, new_fullpath = None, force = False, always_copy = False, prefer_hardlink_to_copy = False, always_move = False, always_hardlink = False, leave_symlink = False, create_dirs = True, getPathPreview = False): """Moves the file to a new path. If it is on the same partition, it will be moved (unless always_copy is True) @@ -1102,10 +1102,10 @@ def newPath(self, new_path = None, new_fullpath = None, force = False, always_co new_fullpath, self.filename)) if same_partition(self.filename, new_dir): - if always_copy: + if always_copy and not Config['prefer_hardlink_to_copy']: # Same partition, but forced to copy copy_file(self.filename, new_fullpath) - elif Config['prefer_hardlink_to_copy'] or always_hardlink: + elif always_hardlink or (always_copy and Config['prefer_hardlink_to_copy']): # Create a new hardlink to old file hardlink_file(self.filename, new_fullpath) else: