diff options
author | Soumith Chintala <soumith@gmail.com> | 2017-04-30 14:54:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-30 14:54:58 +0300 |
commit | 9e2f875d0ee3d82e16d87b5abc0d64c92b50fd10 (patch) | |
tree | 2140c698d3cda70c2f5c451e89bbcafe9c6bfd74 | |
parent | ed2b0f48a9f3b4aa47ec5fab5abcabcedac4f97d (diff) | |
parent | c4a04623986e6c6f0fad4366cf83a80e4ae38fd8 (diff) |
Merge pull request #222 from jdonald/path-spaces
Gracefully handle paths with spaces
-rwxr-xr-x | install.sh | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -4,6 +4,11 @@ SKIP_RC=0 BATCH_INSTALL=0 THIS_DIR=$(cd $(dirname $0); pwd) +if [[ "$THIS_DIR" == *" "* ]]; then + echo "$THIS_DIR: Torch cannot install to a path containing whitespace. +Please try a different path, one without any spaces." + exit 1 +fi PREFIX=${PREFIX:-"${THIS_DIR}/install"} TORCH_LUA_VERSION=${TORCH_LUA_VERSION:-"LUAJIT21"} # by default install LUAJIT21 @@ -187,7 +192,7 @@ fi WRITE_PATH_TO_PROFILE=0 if [[ $BATCH_INSTALL == 0 ]]; then - if [ -f $RC_FILE ]; then + if [ -f "$RC_FILE" ]; then echo " Do you want to automatically prepend the Torch install location @@ -210,7 +215,7 @@ to PATH and LD_LIBRARY_PATH in your $RC_FILE? (yes/no) fi fi else - if [[ $RC_FILE ]]; then + if [[ "$RC_FILE" ]]; then WRITE_PATH_TO_PROFILE=1 fi fi @@ -218,10 +223,10 @@ fi if [[ $WRITE_PATH_TO_PROFILE == 1 ]]; then echo " -. $PREFIX/bin/torch-activate" >> $RC_FILE +. $PREFIX/bin/torch-activate" >> "$RC_FILE" echo " -. $PREFIX/bin/torch-activate" >> $HOME/.profile +. $PREFIX/bin/torch-activate" >> "$HOME"/.profile else echo " |