From 70f9f111efc2fc6d2707db69656812cf55a86288 Mon Sep 17 00:00:00 2001 From: Julien Vincent Date: Sun, 29 Oct 2023 16:45:48 +0000 Subject: [PATCH] Fix missing parent dir bug when fetching include files --- src/k16/kl/api/fs.clj | 3 --- src/k16/kl/api/resolver/downloader.clj | 13 ++++++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/k16/kl/api/fs.clj b/src/k16/kl/api/fs.clj index 41cbd3b..309a598 100644 --- a/src/k16/kl/api/fs.clj +++ b/src/k16/kl/api/fs.clj @@ -32,9 +32,6 @@ (defn from-submodule-dir ^java.io.File [group-name module-name & segments] (from-submodule-work-dir group-name ".modules" (name module-name) (flatten segments))) -(defn from-submodule-build-dir ^java.io.File [group-name module-name & segments] - (from-submodule-dir group-name module-name "build" segments)) - (defn read-edn [^java.io.File file] (try (edn/read-string (slurp file)) diff --git a/src/k16/kl/api/resolver/downloader.clj b/src/k16/kl/api/resolver/downloader.clj index 18c9b1d..875c88d 100644 --- a/src/k16/kl/api/resolver/downloader.clj +++ b/src/k16/kl/api/resolver/downloader.clj @@ -2,9 +2,8 @@ (:require [cli-matic.utils :as cli.util] [clojure.edn :as edn] - [clojure.java.io :as io] [clojure.string :as str] - [k16.kl.api.fs :as api.config] + [k16.kl.api.fs :as api.fs] [k16.kl.api.github :as api.github] [k16.kl.log :as log] [promesa.core :as p])) @@ -37,12 +36,12 @@ :or {subdir ".kl"}} module sha-short (subs sha 0 7) - build-dir (-> (api.config/from-submodule-build-dir group-name module-name) - .toString) + submodule-dir (-> (api.fs/from-submodule-dir group-name module-name) + .toString) vars {:SHA sha :SHA_SHORT sha-short - :DIR build-dir}] + :DIR submodule-dir}] (log/info (str "Downloading " url "@" sha-short)) @@ -57,6 +56,6 @@ (log/info (str "Downloading " file " [" module-name "]")) (let [contents (-> (read-repo-file url sha (relative-to subdir file)) (replace-vars vars))] - (spit (io/file build-dir file) contents))))))) + (spit (api.fs/from-submodule-dir group-name module-name file) contents))))))) - (api.config/write-edn (api.config/from-submodule-dir group-name module-name "module.edn") config)))) + (api.fs/write-edn (api.fs/from-submodule-dir group-name module-name "module.edn") config))))