File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 (:require
33 [babashka.fs :as fs]
44 [defold.constants :refer [base-class-name]]
5- [defold.mini :as mini]
6- [defold.utils :refer [command-exists? determine-os project-id run-shell]]
5+ [defold.utils :refer [command-exists? determine-os load-ini project-id
6+ run-shell]]
77 [taoensso.timbre :as log]))
88
99(defn switch-focus [type name]
9797 (assert (some? root-dir))
9898 (let [game-project (fs/path root-dir " game.project" )
9999 _ (assert (fs/exists? game-project))
100- config (mini/parse-string ( slurp ( str game-project)) )
100+ config (load-ini game-project)
101101 title (get-in config [" project" " title" ])
102102 _ (assert (some? title))]
103103 (case (determine-os )
Original file line number Diff line number Diff line change 137137 (let [k value
138138 tokens (expect-token (rest tokens) :equal )
139139 [v tokens] (case (peek-token tokens)
140- :ident (consume-token tokens)
141- :string (consume-token tokens)
142- (parser-error (format " Unexpected token: %s" (ffirst tokens)) (last (first tokens))))
140+ :ident (consume-token tokens)
141+ :string (consume-token tokens)
142+ :newline [nil tokens]
143+ (parser-error (format " Unexpected token (line): %s" (ffirst tokens)) (last (first tokens))))
143144 tokens (expect-token tokens [:newline :eof ])]
144145 (if current-section
145146 (recur tokens (assoc-in result (concat current-section [k]) v) current-section nil )
Original file line number Diff line number Diff line change 22 (:require
33 [babashka.fs :as fs]
44 [clojure.string :as string]
5- [defold.mini :as mini]
65 [defold.script-api-compiler :as script-api-compiler]
7- [defold.utils :as utils]
6+ [defold.utils :as utils :refer [load-ini] ]
87 [taoensso.timbre :as log])
98 (:import
109 [java.nio.charset StandardCharsets]
5554 (let [game-projects (find-game-project-files in-dir)]
5655 (flatten (map (fn [game-project]
5756 (let [project-dir (fs/parent game-project)
58- config (mini/parse-string ( slurp ( str game-project)) )
57+ config (load-ini game-project)
5958 libs (get-in config [" library" " include_dirs" ])]
6059 (map #(str (fs/path project-dir %)) (string/split libs #"," ))))
6160 game-projects))))
8786 (fs/delete-tree deps-dir)
8887 (fs/delete-tree cache-dir))
8988 (let [ident (make-ident game-project-file)
90- ini (mini/parse-string ( slurp game-project-file) )
89+ ini (load-ini game-project-file)
9190 deps (get-dependencies ini)
9291 deps-dir (deps-dir ident)
9392 cache-dir (cache-dir ident)]
Original file line number Diff line number Diff line change 55 [babashka.process :refer [shell]]
66 [clojure.java.io :as io]
77 [clojure.string :as string]
8+ [defold.mini :as mini]
89 [taoensso.timbre :as log]))
910
1011(defn command-exists? [cmd]
129130
130131(defn project-id [project-root]
131132 (subs (sha3 project-root) 0 8 ))
133+
134+ (defn load-ini [path]
135+ (log/debug " Loading .ini file" (str path))
136+ (mini/parse-string (slurp (str path))))
You can’t perform that action at this time.
0 commit comments