Skip to content

Commit

Permalink
support customizing install directory with $DPATH
Browse files Browse the repository at this point in the history
This introduces the $DPATH environment variable to override the user's home directory just for D tools.

This is also intended to be used by DUB (dlang/dub#2281) when there is not the more explicit `$DUB_HOME` variable set on the system.

This allows users who install their D compiler through the install.sh script to both have the compiler installations as well as the dub packages be stored elsewhere in the system than in their home folder.

In case we have other tools that download their dependencies into the user's home directory, we should also make them support the same $DPATH environment variable.
  • Loading branch information
WebFreak001 committed Jun 28, 2022
1 parent 194c9c8 commit 8555cd4
Showing 1 changed file with 13 additions and 5 deletions.
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

0 comments on commit 8555cd4

Please sign in to comment.