diff --git a/config.sh b/config.sh index 79106bc46b839fe68805bdf6871d20c20e423dbc..ddb5187cea0b93920908240b6f8b0111b2b66be8 100755 --- a/config.sh +++ b/config.sh @@ -1,4 +1,2 @@ #!/bin/bash -#configure working directories -export workingDirectory="/where/gamepad-switcher/is" -export killProcessesScript="a/shell/file/that/will/be/created/and/erased/in/working/directory" \ No newline at end of file +export killProcessesScript="killControllers.sh" \ No newline at end of file diff --git a/game.sh b/game.sh index 4f75039ff5d22c6c615abd75f0a1665865c9ff9b..439bffe7efe8aa1becad6e777283bf364fc17bf4 100755 --- a/game.sh +++ b/game.sh @@ -4,8 +4,10 @@ # 2 → name of the game as suggested in menu #configuration -. ./config.sh +export workingDirectory="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" +#(thanks http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in) cd $workingDirectory +. ./config.sh if [ -e "$killProcessesScript" ] then echo "There seems to be (a) running instance(s) of the game controller, do you want to brutally kill the processes? (Y/n)\nI'm not sure what it does if you don't…" diff --git a/readme.txt b/readme.txt index ea22ae7507b4139033e9112e9d04196199d6e923..ebe5247befd34abe5733a749a070cba52284c1c0 100644 --- a/readme.txt +++ b/readme.txt @@ -2,4 +2,4 @@ This is a gamepad module switching script intended for use with the Microsoft Xb To permanently add an alias add the following line to ~/.bash_aliases (if the file does not exist, simply create one) and substitute the name and path as necessary: -alias <name_of_alias>="cd /path/to/this/folder && ./game.sh && cd -" +alias <name_of_alias>="/path/to/this/folder/game.sh"