Added setupVariables()
- Global variables now get set up in their own function.
This commit is contained in:
parent
077377efb6
commit
db0d81bfd1
@ -15,13 +15,14 @@ import shutil
|
||||
import webbrowser
|
||||
import time
|
||||
import stat
|
||||
|
||||
scriptPath = os.path.dirname(os.path.realpath(__file__))
|
||||
appPath = sys.argv[1]
|
||||
appName = appPath.replace(os.path.dirname(appPath)+ "\\","")
|
||||
originalAppPath = appPath + " - umlOriginal"
|
||||
tmpAppPath = appPath + " - umlTemp"
|
||||
modPath = os.path.join(appPath,"umlMods")
|
||||
originalModPath = os.path.join(originalAppPath,"umlMods")
|
||||
appPath = False
|
||||
appName = False
|
||||
originalAppPath = False
|
||||
tmpAppPath = False
|
||||
modPath = False
|
||||
originalModPath = False
|
||||
|
||||
#Exception Handler
|
||||
def openFileWithStandardApp(path):
|
||||
@ -75,7 +76,7 @@ def loadMods(output = False):
|
||||
|
||||
os.rename(appPath,originalAppPath)
|
||||
os.rename(tmpAppPath,appPath)
|
||||
#ctypes.windll.kernel32.SetFileAttributesW(originalAppPath,2)
|
||||
ctypes.windll.kernel32.SetFileAttributesW(originalAppPath,2)
|
||||
|
||||
if output: print("Mods have been loaded!")
|
||||
return True
|
||||
@ -87,7 +88,7 @@ def unloadMods(output = False):
|
||||
|
||||
shutil.rmtree(appPath)
|
||||
os.rename(originalAppPath,appPath)
|
||||
#ctypes.windll.kernel32.SetFileAttributesW(appPath,128)
|
||||
ctypes.windll.kernel32.SetFileAttributesW(appPath,128)
|
||||
|
||||
if output: print("Unloading mods successful.")
|
||||
return True
|
||||
@ -183,9 +184,27 @@ def mainMenu():
|
||||
if choice == "2": unloadMods(True); input("Press ENTER to continue.")
|
||||
if choice == "3": openModsFolder()
|
||||
|
||||
def setupVariables():
|
||||
global appPath
|
||||
global appName
|
||||
global originalAppPath
|
||||
global tmpAppPath
|
||||
global modPath
|
||||
global originalModPath
|
||||
|
||||
appPath = sys.argv[1]
|
||||
if os.path.isdir(appPath.replace(" - umlOriginal","")): appPath = appPath.replace(" - umlOriginal","")
|
||||
appName = appPath.replace(os.path.dirname(appPath)+ "\\","")
|
||||
originalAppPath = appPath + " - umlOriginal"
|
||||
tmpAppPath = appPath + " - umlTemp"
|
||||
modPath = os.path.join(appPath,"umlMods")
|
||||
originalModPath = os.path.join(originalAppPath,"umlMods")
|
||||
|
||||
#Init
|
||||
setupVariables()
|
||||
title("Fier's Universal Modloader: " +appName)
|
||||
|
||||
cleanUp()
|
||||
checkUp()
|
||||
while True:
|
||||
mainMenu()
|
||||
mainMenu()
|
||||
|
Loading…
Reference in New Issue
Block a user