1
0
mirror of https://github.com/janet-lang/janet synced 2024-10-01 16:30:40 +00:00

Assert that prime-bunlde-paths is working.

This commit is contained in:
Calvin Rose 2024-05-26 10:54:00 -05:00
parent 6998865d7b
commit 1225cd31c8
2 changed files with 8 additions and 4 deletions

View File

@ -4023,7 +4023,10 @@
(defn- prime-bundle-paths
[]
(os/mkdir (bundle-dir)))
(def s (sep))
(def path (string (dyn *syspath*) s "bundle"))
(os/mkdir path)
(assert (os/stat path :mode)))
(defn- get-files [manifest]
(def files (get manifest :files @[]))
@ -4223,6 +4226,8 @@
(assert (next bundle-name) "cannot use empty bundle-name")
(assert (not (fexists (get-manifest-filename bundle-name)))
"bundle is already installed")
# Setup installed paths
(prime-bundle-paths)
# Check meta file for dependencies
(def infofile-pre (string path s "bundle" s "info.jdn"))
(when (os/stat infofile-pre :mode)
@ -4230,8 +4235,6 @@
(def deps (get info :deps @[]))
(def missing (seq [d :in deps :when (not (bundle/installed? d))] (string d)))
(when (next missing) (errorf "missing dependencies %s" (string/join missing ", "))))
# Setup installed paths
(prime-bundle-paths)
(os/mkdir (bundle-dir bundle-name))
# Copy some files into the new location unconditionally
(def implicit-sources (string path s "bundle"))

View File

@ -2417,8 +2417,9 @@ JANET_CORE_FN(os_dir,
dp = readdir(dfd);
if (dp == NULL) {
if (errno) {
int olderr = errno;
closedir(dfd);
janet_panicf("failed to read directory %s: %s", dir, janet_strerror(errno));
janet_panicf("failed to read directory %s: %s", dir, janet_strerror(olderr));
}
break;
}