Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support customizing install directory with $DPATH #510

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/dpath.dd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The `install.sh` script now respects the `$DPATH` environment variable

The `$DPATH` environment variable can be set on any system to make the install location of the install.sh script as well as other D related tools like DUB to store their cache files, dependencies, installed compilers, etc.

This way you can change where all the D tools are installed and keep a clean home folder.
18 changes: 13 additions & 5 deletions script/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,21 @@ GET_PATH_AUTO_INSTALL=0
GET_PATH_COMPILER=dc
# Set a default install path depending on the POSIX/Windows environment.
if posix_terminal; then
ROOT=~/dlang
if [ -z "$DPATH" ]; then
ROOT=~/dlang
else
ROOT="$DPATH/dlang"
fi
else
# Default to a ROOT that is outside the POSIX-like environment.
if [ -z "$USERPROFILE" ]; then
fatal '%USERPROFILE% should not be empty on Windows.';
if [ -z "$DPATH" ]; then
# Default to a ROOT that is outside the POSIX-like environment.
if [ -z "$USERPROFILE" ]; then
fatal '%USERPROFILE% should not be empty on Windows.';
fi
ROOT=$(posix_path "$USERPROFILE")/dlang
else
ROOT=$(posix_path "$DPATH")/dlang
fi
ROOT=$(posix_path "$USERPROFILE")/dlang
fi
TMP_ROOT=
DUB_VERSION=
Expand Down