Merge pull request #4 from kevroded/Testing

Error prevention mechanisms added
This commit is contained in:
Kevin Rode 2019-10-30 16:06:40 -04:00 committed by GitHub
commit c8e9845954
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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")