Skip to content

Commit

Permalink
Fix hardlink on Windows (#332)
Browse files Browse the repository at this point in the history
os.link() isn't on windows.
  • Loading branch information
BarmonHammer committed May 1, 2020
1 parent 71122c7 commit 7381e9a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/inputstreamhelper/utils.py
Expand Up @@ -261,14 +261,13 @@ def arch():

def hardlink(src, dest):
"""Hardlink a file when possible, copy when needed"""
from os import link

if exists(dest):
delete(dest)

try:
from os import link
link(src, dest)
except (AttributeError, OSError):
except (AttributeError, OSError, ImportError):
return copy(src, dest)
log(2, "Hardlink file '{src}' to '{dest}'.", src=src, dest=dest)
return True

0 comments on commit 7381e9a

Please sign in to comment.