From 6db7d177aee3dd3849ed9dd1702056880b5d6231 Mon Sep 17 00:00:00 2001 From: Anthony Plunkett Date: Tue, 9 Feb 2016 17:36:22 -0400 Subject: [PATCH] Only try and delete if exists! --- assets/install.ps1 | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/assets/install.ps1 b/assets/install.ps1 index 45e9b7c2..80fe01e4 100644 --- a/assets/install.ps1 +++ b/assets/install.ps1 @@ -33,6 +33,12 @@ def find_location(): return None, None return install_dir, os.path.join(install_dir, LIB) +def deletion_error(func, path, excinfo): + print 'Problem deleting {}'.format(path) + print 'Please try and delete {} manually'.format(path) + print 'Aborted!' + sys.exit() + def fail(message): print 'Error: %s' % message sys.exit(1) @@ -98,20 +104,12 @@ def main(): ).lower().strip() if input in ('', 'y'): + shutil.rmtree(get_location()) break elif input == 'n': print 'Aborted!' sys.exit() - def report_error(func, path, excinfo): - print('Problem deleting {}, {}, {}'.format(func, path, excinfo)) - print('Please try and delete {} manually'.format(get_location()) - print('Aborted!') - sys.exit() - - shutil.rmtree(get_location(), onerror=report_error) - - print ' Installing at: %s' % install_dir while 1: input = raw_input('Continue? [Yn] ').lower().strip()