Error prevention mechanisms added

This commit is contained in:
Kevin Rode 2019-10-03 13:36:02 -04:00
parent 71f67b709a
commit 2680ddca0a
2 changed files with 33 additions and 20 deletions

View File

@ -12,7 +12,6 @@ def recovery_boot():
else: else:
device = root.adb_connect() device = root.adb_connect()
root.twrp_download(device) root.twrp_download(device)
root.push_files(device)
root.reboot_bootloader() root.reboot_bootloader()
adb = "platform-tools\\adb.exe" adb = "platform-tools\\adb.exe"
fastboot = "platform-tools\\fastboot.exe" fastboot = "platform-tools\\fastboot.exe"
@ -20,6 +19,15 @@ def recovery_boot():
for file in files: for file in files:
if "twrp" in file: if "twrp" in file:
twrp = file twrp = file
else:
twrploc = 0
while twrploc == 0:
input("TWRP not found. Please ensure it is in the correct location and press enter to continue. ")
files = os.listdir(os.curdir)
for file in files:
if "twrp" in file:
twrp = file
twrploc = 1
os.system(fastboot + " boot "+twrp) os.system(fastboot + " boot "+twrp)
input("Press Enter when TWRP has booted") input("Press Enter when TWRP has booted")
@ -44,6 +52,7 @@ def download_app(o=None):
else: else:
os.system(adb+" pull /sdcard/"+app) os.system(adb+" pull /sdcard/"+app)
else: else:
if os.path.isdir(o) == False:
os.makedirs(o) os.makedirs(o)
os.system(adb+" pull /sdcard/"+app+" "+o) os.system(adb+" pull /sdcard/"+app+" "+o)

View File

@ -54,6 +54,10 @@ def twrp_download(d):
for file in files: for file in files:
if "twrp" in file: if "twrp" in file:
found = 1 found = 1
else:
print("Error. Returning to the main menu")
time.sleep(2)
else: else:
print("twrp already downloaded") print("twrp already downloaded")