Skip to content

Commit

Permalink
Editor: Fix broken transpiler save-data queries
Browse files Browse the repository at this point in the history
  • Loading branch information
matgis committed May 14, 2024
1 parent 8e522f5 commit 08a0663
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions editor/src/clj/editor/code/transpilers.clj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
[editor.fs :as fs]
[editor.graph-util :as gu]
[editor.resource :as resource]
[editor.resource-node :as resource-node]
[editor.ui :as ui]
[editor.workspace :as workspace]
[internal.java :as java]
Expand Down Expand Up @@ -56,14 +57,14 @@

(defn- make-temporary-compile-directory! [transpiler all-source-save-datas]
(let [dir (fs/create-temp-directory! (str "tr-" (.getSimpleName (class transpiler))))]
(run! (fn [{:keys [resource content dirty?]}]
(run! (fn [{:keys [resource dirty] :as save-data}]
(let [file (io/file dir (resource/path resource))]
(io/make-parents file)
(if content
(spit file content)
(if-some [modified-content (resource-node/save-data-content save-data)]
(spit file modified-content)
(with-open [is (io/input-stream resource)]
(io/copy is file)))
(when-not dirty?
(when-not dirty
(.setLastModified file (.lastModified (io/file resource))))))
all-source-save-datas)
dir))
Expand All @@ -74,8 +75,8 @@
all-sources (conj source-code-save-datas build-file-save-data)
workspace (resource/workspace (:resource build-file-save-data))
proj-path->node-id (pair-map-by (comp resource/proj-path :resource) :node-id all-sources)
use-project-dir (every? (fn [{:keys [resource dirty?]}]
(and (not dirty?) (resource/file-resource? resource)))
use-project-dir (every? (fn [{:keys [resource dirty]}]
(and (not dirty) (resource/file-resource? resource)))
all-sources)
;; We transpile to lua from the project dir only if all the source code files exist on disc. Since
;; some source file may come as dependencies in zip archives or modified in memory without saving
Expand Down

0 comments on commit 08a0663

Please sign in to comment.