Fast mod-reload added + File counter, progress

This commit is contained in:
Fierelier 2018-09-28 20:02:05 +02:00
parent 936b3a9000
commit 618263b5d4

View File

@ -110,12 +110,19 @@ def cloneMods(modDir):
else: else:
cloneFolder(os.path.join(root,dir),tmpAppPath,True,False,True) cloneFolder(os.path.join(root,dir),tmpAppPath,True,False,True)
def loadMods(output = False): def loadMods(output = False, fast = False):
if fast == False:
if areModsLoaded(): if areModsLoaded():
if unloadMods() == False: if unloadMods() == False:
if output: print("Unloading mods failed!") if output: print("Unloading mods failed!")
return False return False
if fast == True:
if areModsLoaded() == False:
if output: print("Can not fast-load mods when mods aren't loaded.")
return False
if fast == False:
print("Claiming app folder...") print("Claiming app folder...")
claimFolder(appPath) claimFolder(appPath)
print("Claiming mod folder...") print("Claiming mod folder...")
@ -127,6 +134,11 @@ def loadMods(output = False):
os.rename(appPath,originalAppPath) os.rename(appPath,originalAppPath)
os.rename(tmpAppPath,appPath) os.rename(tmpAppPath,appPath)
else:
os.rename(appPath,tmpAppPath)
cloneMods(modPath)
os.rename(tmpAppPath,appPath)
#ctypes.windll.kernel32.SetFileAttributesW(originalAppPath,2) #ctypes.windll.kernel32.SetFileAttributesW(originalAppPath,2)
if output: print("\nMods have been loaded!") if output: print("\nMods have been loaded!")
@ -243,14 +255,16 @@ def mainMenu():
print("") print("")
print("Please choose an action:") print("Please choose an action:")
print("1) Reload Mods") print("1) Reload Mods")
print("2) Unload Mods") print("2) Fast-Load Mods")
print("3) Open Mods-Folder") print("3) Unload Mods")
print("4) Open Mods-Folder")
choice = input("Choice: ") choice = input("Choice: ")
clear() clear()
if choice == "1": loadMods(True); input("Press ENTER to continue.") if choice == "1": loadMods(True); input("Press ENTER to continue.")
if choice == "2": unloadMods(True); input("Press ENTER to continue.") if choice == "2": loadMods(True,True); input("Press ENTER to continue.")
if choice == "3": openModsFolder() if choice == "3": unloadMods(True); input("Press ENTER to continue.")
if choice == "4": openModsFolder()
def requestAppPath(): def requestAppPath():
while True: while True: