From 640cb776a5a6ce8f802ede1b8dd14ba9e9b20e58 Mon Sep 17 00:00:00 2001 From: nicco Date: Sun, 21 Jan 2018 14:00:46 +0100 Subject: [PATCH] Version 1.1 --- ixesha | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/ixesha b/ixesha index e3a6fc1..01a78bb 100755 --- a/ixesha +++ b/ixesha @@ -1,5 +1,7 @@ #! /usr/bin/env python3 +__version__ = '1.1' + from sys import argv from argparse import ArgumentParser from shutil import copy @@ -34,20 +36,34 @@ parser.add_argument('-o', '--to', '--output', nargs=1, dest='output', metavar='< def install(): - copy( - os.path.abspath(__file__), - os.path.abspath(S['installDir'])) + i = os.path.abspath(__file__) + o = os.path.join( + os.path.abspath(S['installDir']), + os.path.basename(__file__) + ) + + if os.path.exists(o): + print('{app} already installed in: {path}'.format( + app=S['app'], path=S['installDir'])) + return + + copy(i, o) print('Successfully installed {app} in: {path}'.format( app=S['app'], path=S['installDir'])) def uninstall(): - os.remove( - os.path.join( - os.path.abspath(S['installDir']), - os.path.basename(__file__) - ) + o = os.path.join( + os.path.abspath(S['installDir']), + os.path.basename(__file__) ) + + if not os.path.exists(o): + print('{app} not installed in: {path}'.format( + app=S['app'], path=S['installDir'])) + return + + os.remove(o) print('Successfully uninstalled {app} from: {path}'.format( app=S['app'], path=S['installDir']))