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
|
#Imports and variables
|
||||||
umlVer = 0
|
umlVer = 0
|
||||||
umlSubVer = 7
|
umlSubVer = 7
|
||||||
umlFeatureSet = 2
|
umlFeatureSet = 3
|
||||||
umlBranch = "beta (dev)"
|
umlBranch = "beta (dev)"
|
||||||
umlVerStr = str(umlVer) + "." + str(umlSubVer) + "." +str(umlFeatureSet)+ " " + umlBranch
|
umlVerStr = str(umlVer) + "." + str(umlSubVer) + "." +str(umlFeatureSet)+ " " + umlBranch
|
||||||
|
|
||||||
@ -129,18 +129,35 @@ def loadMods(output = False, fast = False):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
if fast == False:
|
if fast == False:
|
||||||
|
if areModsLoaded():
|
||||||
|
if output: print("Mods are already loaded and could not be unloaded.")
|
||||||
|
return False
|
||||||
|
|
||||||
print("Claiming app folder...")
|
print("Claiming app folder...")
|
||||||
claimFolder(appPath)
|
claimFolder(appPath)
|
||||||
print("Claiming mod folder...")
|
print("Claiming mod folder...")
|
||||||
claimFolder(modPath)
|
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...")
|
print("Cloning app folder...")
|
||||||
cloneFolder(appPath,tmpAppPath,False)
|
cloneFolder(appPath,tmpAppPath,False)
|
||||||
|
|
||||||
print("Cloning mods...")
|
print("Cloning mods...")
|
||||||
cloneMods(modPath)
|
cloneMods(modPath)
|
||||||
|
|
||||||
os.rename(appPath,originalAppPath)
|
os.rename(appPath,originalAppPath)
|
||||||
os.rename(tmpAppPath,appPath)
|
os.rename(tmpAppPath,appPath)
|
||||||
else:
|
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)
|
os.rename(appPath,tmpAppPath)
|
||||||
cloneMods(modPath)
|
cloneMods(modPath)
|
||||||
os.rename(tmpAppPath,appPath)
|
os.rename(tmpAppPath,appPath)
|
||||||
@ -155,6 +172,13 @@ def unloadMods(output = False):
|
|||||||
if output: print("Mods are already unloaded.")
|
if output: print("Mods are already unloaded.")
|
||||||
return True
|
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...")
|
print("Removing cloned app folder...")
|
||||||
shutil.rmtree(appPath)
|
shutil.rmtree(appPath)
|
||||||
os.rename(originalAppPath,appPath)
|
os.rename(originalAppPath,appPath)
|
||||||
|
Loading…
Reference in New Issue
Block a user