aboutsummaryrefslogtreecommitdiffhomepage
path: root/jpm
diff options
context:
space:
mode:
authorCalvin Rose <calsrose@gmail.com>2021-01-03 13:09:41 -0600
committerCalvin Rose <calsrose@gmail.com>2021-01-03 13:09:41 -0600
commitecc6eb749720fefcfb532799aaf95aaeba254b94 (patch)
tree40fd51446bb2dff7e7e5c206a66914869dc07400 /jpm
parentDon't print to stderr in Makefile to detect version. Fix #544 (diff)
Don't fail jpm if os/realpath fails.
Diffstat (limited to 'jpm')
-rwxr-xr-xjpm21
1 files changed, 19 insertions, 2 deletions
diff --git a/jpm b/jpm
index d03844b9..52e2e4d8 100755
--- a/jpm
+++ b/jpm
@@ -22,6 +22,19 @@
###START###
# Overriden on some installs.
+# To configure this script, replace the code between
+# the START and END comments and define a function
+# (install-paths) that gives the the default paths
+# to use. Trailing directory separator not expected.
+#
+# Example.
+#
+# (defn- install-paths []
+# {:headerpath "/usr/local/include/janet"
+# :libpath "/usr/local/lib/janet"
+# :binpath "/usr/local/bin"
+#
+
(def- exe-dir
"Directory containing jpm script"
(do
@@ -29,9 +42,13 @@
(def i (last (string/find-all sep exe)))
(slice exe 0 i)))
+(defn- try-real [path]
+ "If os/realpath fails just use normal path."
+ (try (os/realpath) ([_] path)))
+
(defn- install-paths []
- {:headerpath (os/realpath (string exe-dir "/../include/janet"))
- :libpath (os/realpath (string exe-dir "/../lib"))
+ {:headerpath (try-real (string exe-dir "/../include/janet"))
+ :libpath (try-real (string exe-dir "/../lib"))
:binpath exe-dir})
###END###