Btrfs fix

This commit is contained in:
Fierelier 2020-10-04 16:35:32 +02:00
parent ce3bffb0a9
commit b36ec90fea
1 changed files with 6 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import shutil
import webbrowser
import configparser
import subprocess
import ctypes
oldexcepthook = sys.excepthook
def newexcepthook(type,value,traceback):
@ -87,6 +88,7 @@ def getModlist(path,sort = True):
if sort == True: return sorted(modList)
return modList
btrfsdll = False
def linkFile(src,dst,method = False):
if not method: method = config["default"]["linkMethod"]
if method == "hardlink":
@ -98,8 +100,10 @@ def linkFile(src,dst,method = False):
return
if method == "reflink":
if os.system == "nt":
subprocess.call(["rundll32.exe","shellbtrfs.dll,ReflinkCopy",src,dst])
if os.name == "nt":
global btrfsdll
if not btrfsdll: btrfsdll = ctypes.cdll.LoadLibrary("shellbtrfs.dll")
btrfsdll.ReflinkCopyW(src,dst)
else:
subprocess.call(["cp","-n","--reflink=always",src,dst])
return