Skip to content

Commit

Permalink
Handle case when both always_copy and prefer_hardlink_to_copy are True
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylvain Willy committed Apr 10, 2020
1 parent d9aa003 commit bdbcce8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tvnamer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit bdbcce8

Please sign in to comment.