Skip to content

Commit

Permalink
remove game folder if download failed
Browse files Browse the repository at this point in the history
  • Loading branch information
christopher-roelofs committed May 2, 2017
1 parent e3e996f commit 94c3982
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/FunKiiUmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,7 @@ def start(self):
self.log('ERROR: Could not download TMD...')
self.log('MAYBE YOU ARE BLOCKING CONNECTIONS TO NINTENDO? IF YOU ARE, DON\'T...! :)')
self.log('Skipping title...')
if not self.run:
shutil.rmtree(rawdir, ignore_errors=True)
shutil.rmtree(rawdir, ignore_errors=True)
return

with open(os.path.join(rawdir, 'title.cert'), 'wb') as f:
Expand All @@ -372,17 +371,15 @@ def start(self):
self.log('ERROR: Could not download ticket from {}'.format(
baseurl + '/cetk'))
self.log('Skipping title...')
if not self.run:
shutil.rmtree(rawdir, ignore_errors=True)
shutil.rmtree(rawdir, ignore_errors=True)
return
elif self.onlinetickets:
keysite = get_keysite()
tikurl = 'https://{}/ticket/{}.tik'.format(keysite, self.title_id)
if not download_file(tikurl, os.path.join(rawdir, 'title.tik'), self.retry_count):
self.log('ERROR: Could not download ticket from {}'.format(keysite))
self.log('Skipping title...')
if not self.run:
shutil.rmtree(rawdir, ignore_errors=True)
shutil.rmtree(rawdir, ignore_errors=True)
return
else:
make_ticket(self.title_id, self.title_key, title_version, os.path.join(
Expand Down Expand Up @@ -417,13 +414,11 @@ def start(self):

if not self.download_file('{}/{}'.format(baseurl, c_id), outfname, self.retry_count, expected_size=expected_size):
self.log('ERROR: Could not download content file... Skipping title')
if not self.run:
shutil.rmtree(rawdir, ignore_errors=True)
shutil.rmtree(rawdir, ignore_errors=True)
return
if not self.download_file('{}/{}.h3'.format(baseurl, c_id), outfnameh3, self.retry_count, ignore_404=True):
self.log('ERROR: Could not download h3 file... Skipping title')
if not self.run:
shutil.rmtree(rawdir, ignore_errors=True)
shutil.rmtree(rawdir, ignore_errors=True)
return

self.percent = str(int((float(i + 1) / float(content_count))*100)) + "%"
Expand Down

0 comments on commit 94c3982

Please sign in to comment.