~subsetpark/bagatto

ref: 018d2f87b6f0b047a86ce59ebc05443be81be835 bagatto/src/env.janet -rw-r--r-- 371 bytes
018d2f87 — Zach Smith Remove blacklist code 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(import spork/temple)

(defn- on-path?
  [prog]
  (let [f (file/open "/dev/null" :w)]
    (case (os/execute ["which" prog] :p {:out f :err f})
      0 true
      false)))

(defn- prepare-syspath! []
  (match (os/getenv "JANET_PATH")
    nil :ok
    janet-path (put root-env :syspath janet-path)))

(defn prepare-root-env!
  []
  (prepare-syspath!)
  (temple/add-loader))