Skip to content

Commit

Permalink
Align home-dir with original scripts
Browse files Browse the repository at this point in the history
The original bash script uses the `HOME` environment variable[1] to determine the user's home
directory while we were using thee `user.home` JVM property on non-windows platforms. This turns out
to not be equivalent (see e.g. JDK-8280357[2] for a recent issue caused by this). So instead, we now
also use the environment variable.

As it turns out, the original Powershell script also first checks the `HOME` environment variable[3]
before falling back to `USERPROFILE` (which is what we were using so far), so we also align that to
ensure equivalent behavior. This also means we can drop the "workaround" comment here since it no
longer is one.

Closes borkdude#114.

[1]  https://github.com/clojure/brew-install/blob/b03428b1b31a8d60573a284d6971fbd3db7b748d/src/main/resources/clojure/install/clojure#L280
[2]  https://bugs.openjdk.org/browse/JDK-8280357
[3]  https://github.com/clojure/brew-install/blob/dabb82bd011b0510006dd88464f350052adb69b5/src/main/resources/clojure/install/ClojureTools.psm1#L254-L258
  • Loading branch information
DerGuteMoritz committed Oct 11, 2023
1 parent cc9ddf4 commit 34c55fe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions deps.bat
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,9 @@ For more info, see:

(defn- home-dir []
(if windows?
;; workaround for https://github.com/oracle/graal/issues/1630
(*getenv-fn* "userprofile")
(System/getProperty "user.home")))
(or (*getenv-fn* "home")
(*getenv-fn* "userprofile"))
(*getenv-fn* "home")))

(def ^:private java-exe (if windows? "java.exe" "java"))

Expand Down
6 changes: 3 additions & 3 deletions deps.clj
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ For more info, see:

(defn- home-dir []
(if windows?
;; workaround for https://github.com/oracle/graal/issues/1630
(*getenv-fn* "userprofile")
(System/getProperty "user.home")))
(or (*getenv-fn* "home")
(*getenv-fn* "userprofile"))
(*getenv-fn* "home")))

(def ^:private java-exe (if windows? "java.exe" "java"))

Expand Down
6 changes: 3 additions & 3 deletions src/borkdude/deps.clj
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ For more info, see:

(defn- home-dir []
(if windows?
;; workaround for https://github.com/oracle/graal/issues/1630
(*getenv-fn* "userprofile")
(System/getProperty "user.home")))
(or (*getenv-fn* "home")
(*getenv-fn* "userprofile"))
(*getenv-fn* "home")))

(def ^:private java-exe (if windows? "java.exe" "java"))

Expand Down

0 comments on commit 34c55fe

Please sign in to comment.