Access test plopped into function
This commit is contained in:
parent
4d23c17586
commit
c5a95d5868
@ -42,6 +42,13 @@ def openFileWithStandardApp(path):
|
|||||||
else:
|
else:
|
||||||
subprocess.call(['xdg-open', path])
|
subprocess.call(['xdg-open', path])
|
||||||
|
|
||||||
|
def testAccess(path):
|
||||||
|
try:
|
||||||
|
os.rename(path,path)
|
||||||
|
return True
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
|
||||||
def exceptionCleanup():
|
def exceptionCleanup():
|
||||||
success = True
|
success = True
|
||||||
print("Attempting cleanup.")
|
print("Attempting cleanup.")
|
||||||
@ -138,9 +145,7 @@ def loadMods(output = False, fast = False):
|
|||||||
print("Claiming mod folder...")
|
print("Claiming mod folder...")
|
||||||
claimFolder(modPath)
|
claimFolder(modPath)
|
||||||
print("Testing access...")
|
print("Testing access...")
|
||||||
try:
|
if testAccess(appPath) == False:
|
||||||
os.rename(appPath,appPath)
|
|
||||||
except Exception as e:
|
|
||||||
if output: print("Can't access folder! Is it in use?")
|
if output: print("Can't access folder! Is it in use?")
|
||||||
return
|
return
|
||||||
print("Cloning app folder...")
|
print("Cloning app folder...")
|
||||||
@ -153,9 +158,7 @@ def loadMods(output = False, fast = False):
|
|||||||
os.rename(tmpAppPath,appPath)
|
os.rename(tmpAppPath,appPath)
|
||||||
else:
|
else:
|
||||||
print("Testing access...")
|
print("Testing access...")
|
||||||
try:
|
if testAccess(appPath) == False:
|
||||||
os.rename(appPath,appPath)
|
|
||||||
except Exception as e:
|
|
||||||
if output: print("Can't access folder! Is it in use?")
|
if output: print("Can't access folder! Is it in use?")
|
||||||
return
|
return
|
||||||
os.rename(appPath,tmpAppPath)
|
os.rename(appPath,tmpAppPath)
|
||||||
@ -173,9 +176,7 @@ def unloadMods(output = False):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
print("Testing access...")
|
print("Testing access...")
|
||||||
try:
|
if testAccess(appPath) == False:
|
||||||
os.rename(appPath,appPath)
|
|
||||||
except Exception as e:
|
|
||||||
if output: print("Can't access folder! Is it in use?")
|
if output: print("Can't access folder! Is it in use?")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user