sigmavirus24 / Todo.txt-python

Python port of Gina Trapani's popular todo.txt-cli project
GNU General Public License v3.0
46 stars 17 forks source link

install.sh does not work from alternate location #9

Open rushtongarth opened 7 years ago

rushtongarth commented 7 years ago

When executing install.sh line 67 and line 69 assume the current directory is the same as the file todo.py resulting in a file not found error.

Proposed changes:

#!/bin/bash
INSTALL_DIR=$HOME/bin
ALIAS_FILE=$HOME/.bashrc
THIS_SCRIPT=$(readlink -f $0) # Added to get full path to install.sh
CODE_DIR=$(dirname $THIS_SCRIPT) # Added to get full dirname of install.sh
prog="[""$(basename $THIS_SCRIPT)""] "

and

echo $prog"Copying todo.py to $INSTALL_DIR/todo.py"
if [[ ! -f $INSTALL_DIR/todo.py ]] ; then
    # addition of full path via CODE_DIR variable
    cp ${CODE_DIR}/todo.py $INSTALL_DIR
else
    # addition of full path via CODE_DIR variable
    cp -u ${CODE_DIR}/todo.py $INSTALL_DIR
fi

Thoughts?