Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/distro.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoumith Chintala <soumith@gmail.com>2017-04-30 14:54:58 +0300
committerGitHub <noreply@github.com>2017-04-30 14:54:58 +0300
commit9e2f875d0ee3d82e16d87b5abc0d64c92b50fd10 (patch)
tree2140c698d3cda70c2f5c451e89bbcafe9c6bfd74
parented2b0f48a9f3b4aa47ec5fab5abcabcedac4f97d (diff)
parentc4a04623986e6c6f0fad4366cf83a80e4ae38fd8 (diff)
Merge pull request #222 from jdonald/path-spaces
Gracefully handle paths with spaces
-rwxr-xr-xinstall.sh13
1 files changed, 9 insertions, 4 deletions
diff --git a/install.sh b/install.sh
index 5ea1ad9..40fb6a9 100755
--- a/install.sh
+++ b/install.sh
@@ -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 "