From 8988f6ce16f39346b79f55e28ede3ae7fc22739e Mon Sep 17 00:00:00 2001 From: Fierelier Date: Mon, 3 Jul 2017 05:28:02 +0200 Subject: [PATCH] Installscript implementation - Mods can now use installscripts instead of using the default setup. --- UniversalModloader.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/UniversalModloader.py b/UniversalModloader.py index f8842ef..5fb24f8 100644 --- a/UniversalModloader.py +++ b/UniversalModloader.py @@ -62,7 +62,12 @@ def cloneMods(modDir): if dir[0] == "[" and dir[-1:] == "]": cloneMods(os.path.join(root,dir)) 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): if areModsLoaded(): @@ -105,7 +110,7 @@ def areModsLoaded(): 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): newRoot = root.replace(src,dst) if ignoreMods == True: @@ -114,6 +119,8 @@ def cloneFolder(src,dst,rpl,ignoreMods = True): if os.path.isdir(newRoot) == False: os.makedirs(newRoot) for file in files: + if isMod == True: + if file[:4] == "uml_": continue fullFile = os.path.join(root,file) newFile = os.path.join(newRoot,file)