mirror of
https://github.com/janet-lang/janet
synced 2025-11-14 06:17:15 +00:00
Assert that prime-bunlde-paths is working.
This commit is contained in:
@@ -4023,7 +4023,10 @@
|
|||||||
|
|
||||||
(defn- prime-bundle-paths
|
(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]
|
(defn- get-files [manifest]
|
||||||
(def files (get manifest :files @[]))
|
(def files (get manifest :files @[]))
|
||||||
@@ -4223,6 +4226,8 @@
|
|||||||
(assert (next bundle-name) "cannot use empty bundle-name")
|
(assert (next bundle-name) "cannot use empty bundle-name")
|
||||||
(assert (not (fexists (get-manifest-filename bundle-name)))
|
(assert (not (fexists (get-manifest-filename bundle-name)))
|
||||||
"bundle is already installed")
|
"bundle is already installed")
|
||||||
|
# Setup installed paths
|
||||||
|
(prime-bundle-paths)
|
||||||
# Check meta file for dependencies
|
# Check meta file for dependencies
|
||||||
(def infofile-pre (string path s "bundle" s "info.jdn"))
|
(def infofile-pre (string path s "bundle" s "info.jdn"))
|
||||||
(when (os/stat infofile-pre :mode)
|
(when (os/stat infofile-pre :mode)
|
||||||
@@ -4230,8 +4235,6 @@
|
|||||||
(def deps (get info :deps @[]))
|
(def deps (get info :deps @[]))
|
||||||
(def missing (seq [d :in deps :when (not (bundle/installed? d))] (string d)))
|
(def missing (seq [d :in deps :when (not (bundle/installed? d))] (string d)))
|
||||||
(when (next missing) (errorf "missing dependencies %s" (string/join missing ", "))))
|
(when (next missing) (errorf "missing dependencies %s" (string/join missing ", "))))
|
||||||
# Setup installed paths
|
|
||||||
(prime-bundle-paths)
|
|
||||||
(os/mkdir (bundle-dir bundle-name))
|
(os/mkdir (bundle-dir bundle-name))
|
||||||
# Copy some files into the new location unconditionally
|
# Copy some files into the new location unconditionally
|
||||||
(def implicit-sources (string path s "bundle"))
|
(def implicit-sources (string path s "bundle"))
|
||||||
|
|||||||
@@ -2417,8 +2417,9 @@ JANET_CORE_FN(os_dir,
|
|||||||
dp = readdir(dfd);
|
dp = readdir(dfd);
|
||||||
if (dp == NULL) {
|
if (dp == NULL) {
|
||||||
if (errno) {
|
if (errno) {
|
||||||
|
int olderr = errno;
|
||||||
closedir(dfd);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user