mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 05:43:16 -07:00
add jaraco to test sym links on Windows. Fixes #894
This commit is contained in:
parent
fd5ee775e0
commit
52cc753881
50 changed files with 3862 additions and 7 deletions
|
@ -252,14 +252,23 @@ def copy_link(src, targetLink, useLink):
|
|||
return True
|
||||
|
||||
def replace_links(link):
|
||||
if not os.path.islink(link):
|
||||
logger.debug('%s is not a link' % (link))
|
||||
return
|
||||
target = link
|
||||
n = 0
|
||||
while os.path.islink(target):
|
||||
target = os.readlink(target)
|
||||
n = n + 1
|
||||
target = link
|
||||
if os.name == 'nt':
|
||||
import jaraco
|
||||
if not jaraco.windows.filesystem.islink(link):
|
||||
logger.debug('%s is not a link' % (link))
|
||||
return
|
||||
while jaraco.windows.filesystem.islink(target):
|
||||
target = jaraco.windows.filesystem.readlink(target)
|
||||
n = n + 1
|
||||
else:
|
||||
if not os.path.islink(link):
|
||||
logger.debug('%s is not a link' % (link))
|
||||
return
|
||||
while os.path.islink(target):
|
||||
target = os.readlink(target)
|
||||
n = n + 1
|
||||
if n > 1:
|
||||
logger.info("Changing sym-link: %s to point directly to file: %s" % (link, target), 'COPYLINK')
|
||||
os.unlink(link)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue