Added access test
This commit is contained in:
parent
a25a8c7d64
commit
268f3cb0c4
@ -11,7 +11,7 @@ def preloadExceptionHandler(exc_type, exc_value, tb):
|
||||
#Imports and variables
|
||||
umlVer = 0
|
||||
umlSubVer = 7
|
||||
umlFeatureSet = 2
|
||||
umlFeatureSet = 3
|
||||
umlBranch = "beta (dev)"
|
||||
umlVerStr = str(umlVer) + "." + str(umlSubVer) + "." +str(umlFeatureSet)+ " " + umlBranch
|
||||
|
||||
@ -129,18 +129,35 @@ def loadMods(output = False, fast = False):
|
||||
return False
|
||||
|
||||
if fast == False:
|
||||
if areModsLoaded():
|
||||
if output: print("Mods are already loaded and could not be unloaded.")
|
||||
return False
|
||||
|
||||
print("Claiming app folder...")
|
||||
claimFolder(appPath)
|
||||
print("Claiming mod folder...")
|
||||
claimFolder(modPath)
|
||||
print("Testing access...")
|
||||
try:
|
||||
os.rename(appPath,appPath)
|
||||
except Exception as e:
|
||||
if output: print("Can't access folder! Is it in use?")
|
||||
return
|
||||
print("Cloning app folder...")
|
||||
cloneFolder(appPath,tmpAppPath,False)
|
||||
|
||||
print("Cloning mods...")
|
||||
cloneMods(modPath)
|
||||
|
||||
os.rename(appPath,originalAppPath)
|
||||
os.rename(tmpAppPath,appPath)
|
||||
else:
|
||||
print("Testing access...")
|
||||
try:
|
||||
os.rename(appPath,appPath)
|
||||
except Exception as e:
|
||||
if output: print("Can't access folder! Is it in use?")
|
||||
return
|
||||
os.rename(appPath,tmpAppPath)
|
||||
cloneMods(modPath)
|
||||
os.rename(tmpAppPath,appPath)
|
||||
@ -155,6 +172,13 @@ def unloadMods(output = False):
|
||||
if output: print("Mods are already unloaded.")
|
||||
return True
|
||||
|
||||
print("Testing access...")
|
||||
try:
|
||||
os.rename(appPath,appPath)
|
||||
except Exception as e:
|
||||
if output: print("Can't access folder! Is it in use?")
|
||||
return
|
||||
|
||||
print("Removing cloned app folder...")
|
||||
shutil.rmtree(appPath)
|
||||
os.rename(originalAppPath,appPath)
|
||||
|
Loading…
Reference in New Issue
Block a user