Installscript implementation

- Mods can now use installscripts instead of using the default setup.
This commit is contained in:
Fierelier 2017-07-03 05:28:02 +02:00
parent 54e264d22f
commit 8988f6ce16

View File

@ -62,7 +62,12 @@ def cloneMods(modDir):
if dir[0] == "[" and dir[-1:] == "]": if dir[0] == "[" and dir[-1:] == "]":
cloneMods(os.path.join(root,dir)) cloneMods(os.path.join(root,dir))
else: else:
cloneFolder(os.path.join(root,dir),tmpAppPath,True,False) if os.path.isfile(os.path.join(root,dir,"uml_installscript.py")) == True:
file = open(os.path.join(root,dir,"uml_installscript.py"))
exec(file.read(),globals(),locals())
file.close()
else:
cloneFolder(os.path.join(root,dir),tmpAppPath,True,False,True)
def loadMods(output = False): def loadMods(output = False):
if areModsLoaded(): if areModsLoaded():
@ -105,7 +110,7 @@ def areModsLoaded():
return False return False
def cloneFolder(src,dst,rpl,ignoreMods = True): def cloneFolder(src,dst,rpl,ignoreMods = True, isMod = False):
for root,dirs,files in os.walk(src): for root,dirs,files in os.walk(src):
newRoot = root.replace(src,dst) newRoot = root.replace(src,dst)
if ignoreMods == True: if ignoreMods == True:
@ -114,6 +119,8 @@ def cloneFolder(src,dst,rpl,ignoreMods = True):
if os.path.isdir(newRoot) == False: os.makedirs(newRoot) if os.path.isdir(newRoot) == False: os.makedirs(newRoot)
for file in files: for file in files:
if isMod == True:
if file[:4] == "uml_": continue
fullFile = os.path.join(root,file) fullFile = os.path.join(root,file)
newFile = os.path.join(newRoot,file) newFile = os.path.join(newRoot,file)