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,23 +110,35 @@ 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 areModsLoaded(): if fast == False:
if unloadMods() == False: if areModsLoaded():
if output: print("Unloading mods failed!") if unloadMods() == False:
if output: print("Unloading mods failed!")
return False
if fast == True:
if areModsLoaded() == False:
if output: print("Can not fast-load mods when mods aren't loaded.")
return False return False
print("Claiming app folder...") if fast == False:
claimFolder(appPath) print("Claiming app folder...")
print("Claiming mod folder...") claimFolder(appPath)
claimFolder(modPath) print("Claiming mod folder...")
print("Cloning app folder...") claimFolder(modPath)
cloneFolder(appPath,tmpAppPath,False) print("Cloning app folder...")
print("Cloning mods...") cloneFolder(appPath,tmpAppPath,False)
cloneMods(modPath) print("Cloning mods...")
cloneMods(modPath)
os.rename(appPath,originalAppPath)
os.rename(tmpAppPath,appPath) os.rename(appPath,originalAppPath)
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: