Skip to content

Commit

Permalink
Merge pull request #84 from ata2001/master
Browse files Browse the repository at this point in the history
Fixes for the new symlink feature
  • Loading branch information
ghickman committed Mar 3, 2017
2 parents e2e5417 + da91cd8 commit 394938c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions tvrenamr/cli/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def build_file_list(paths, recursive=False, ignore_filelist=()):
"""Finds files from a list of paths"""
for path in paths:
if os.path.isfile(path):
path = os.path.realpath(path)
yield os.path.split(path)

if os.path.isdir(path):
Expand Down
5 changes: 3 additions & 2 deletions tvrenamr/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,10 @@ def rename(self, current_filepath, destination_filepath):
os.symlink(source_filepath, destination_filepath)
elif os.name == 'nt':
import ctypes
source_filepath = source_filepath.decode('UTF-8')
kernel_dll = ctypes.windll.LoadLibrary("kernel32.dll")
kernel_dll.CreateSymbolicLinkA(source_filepath,
destination_filepath, 0)
kernel_dll.CreateSymbolicLinkA(destination_filepath,
source_filepath, 0)
else:
shutil.move(source_filepath, destination_filepath)
destination_file = os.path.split(destination_filepath)[1]
Expand Down

0 comments on commit 394938c

Please sign in to comment.