1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-23 15:00:27 +00:00

Just don't do backslashes.

This commit is contained in:
Calvin Rose 2024-05-25 16:43:51 -05:00
parent eb21d4fff4
commit 4fbc71c70d
2 changed files with 14 additions and 7 deletions

View File

@ -4004,6 +4004,10 @@
[bundle-name filename]
(string (dyn *syspath*) "/bundle/" bundle-name "/" filename))
(defn- bundle-rpath
[path]
(string/replace-all "\\" "/" (os/realpath path)))
(defn- get-manifest-filename
[bundle-name]
(bundle-file bundle-name "manifest.jdn"))
@ -4066,7 +4070,7 @@
(def manifest (bundle/manifest bundle-name))
(def dir (os/cwd))
(def workdir (get manifest :local-source "."))
(def fixed-syspath (os/realpath (dyn *syspath*)))
(def fixed-syspath (bundle-rpath (dyn *syspath*)))
(try
(os/cd workdir)
([_] (print "cannot enter source directory " workdir " for bundle " bundle-name)))
@ -4187,12 +4191,10 @@
"Install a bundle from the local filesystem with a name `bundle-name`."
[&opt path bundle-name &keys config]
(default path ".")
(def path (os/realpath path))
(def path (bundle-rpath path))
(def clean (get config :clean))
(def check (get config :check))
(default bundle-name
(let [sep (if (string/find "\\" path) "\\" "/")]
(last (string/split sep path))))
(default bundle-name (last (string/split sep path)))
(assert (not (string/check-set "\\/" bundle-name))
(string "bundle-name "
bundle-name
@ -4256,7 +4258,7 @@
(def install-hook (string dest-dir "/bundle/init.janet"))
(edefer (rmrf dest-dir) # don't leave garbage on failure
(def install-source @[])
(def syspath (os/realpath (dyn *syspath*)))
(def syspath (bundle-rpath (dyn *syspath*))
(when is-backup (copyrf (bundle-dir bundle-name) (string dest-dir "/old-bundle")))
(each file files
(def {:mode mode :permissions perm} (os/stat file))

View File

@ -24,6 +24,9 @@
(assert true) # smoke test
# Copy since not exposed in boot.janet
(defn- bundle-rpath
[path]
(string/replace-all "\\" "/" (os/realpath path)))
(def- sep (if (= :windows (os/which)) "\\" "/"))
(defn- rmrf
"rm -rf in janet"
@ -40,8 +43,10 @@
(def syspath (string "." sep (string (math/random)) "_jpm_tree.tmp"))
(rmrf syspath)
(assert (os/mkdir syspath))
(put root-env *syspath* (os/realpath syspath))
(put root-env *syspath* (bundle-rpath syspath))
#(setdyn *out* @"")
(pp (bundle/list))
(pp (bundle/topolist))
(assert (empty? (bundle/list)) "initial bundle/list")
(assert (empty? (bundle/topolist)) "initial bundle/topolist")