Added different methods for linking

This commit is contained in:
Fierelier 2020-10-04 13:16:00 +02:00
parent 676d749c08
commit fe446e1d99
1 changed files with 20 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import os
import shutil
import webbrowser
import configparser
import subprocess
oldexcepthook = sys.excepthook
def newexcepthook(type,value,traceback):
@ -86,8 +87,25 @@ def getModlist(path,sort = True):
if sort == True: return sorted(modList)
return modList
def linkFile(src,dst):
os.link(src,dst)
def linkFile(src,dst,method = False):
if not method: method = config["default"]["linkMethod"]
if method == "hardlink":
os.link(src,dst)
return
if method == "copy":
shutil.copy(src,dst)
return
if method == "reflink":
if os.system == "nt":
subprocess.call(["rundll32.exe","shellbtrfs.dll,ReflinkCopy",src,dst])
else:
subprocess.call(["cp","-n","--reflink=always",src,dst])
return
raise Exception("uml", "invalid link method")
def cloneFolder(src,dst):
global listLinked