aboutsummaryrefslogtreecommitdiff
path: root/luxc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--luxc/src/lux/compiler/base.clj12
-rw-r--r--luxc/src/lux/compiler/cache.clj20
-rw-r--r--luxc/src/lux/compiler/io.clj2
3 files changed, 21 insertions, 13 deletions
diff --git a/luxc/src/lux/compiler/base.clj b/luxc/src/lux/compiler/base.clj
index e57571fef..c396504f4 100644
--- a/luxc/src/lux/compiler/base.clj
+++ b/luxc/src/lux/compiler/base.clj
@@ -54,14 +54,14 @@
(defn ^:private write-output [module name data]
(let [module* (&host/->module-class module)
- module-dir (str @!output-dir "/" module*)]
+ module-dir (str @!output-dir java.io.File/separator module*)]
(.mkdirs (File. module-dir))
- (write-file (str module-dir "/" name ".class") data)))
+ (write-file (str module-dir java.io.File/separator name ".class") data)))
(defn class-exists? [^String module ^String class-name]
"(-> Text Text (IO Bool))"
(|do [_ (return nil)
- :let [full-path (str @!output-dir "/" module "/" class-name ".class")
+ :let [full-path (str @!output-dir java.io.File/separator module java.io.File/separator class-name ".class")
exists? (.exists (File. full-path))]]
(return exists?)))
@@ -86,14 +86,14 @@
(defn write-module-descriptor! [^String name ^String descriptor]
(|do [_ (return nil)
- :let [lmd-dir (str @!output-dir "/" name)
+ :let [lmd-dir (str @!output-dir java.io.File/separator name)
_ (.mkdirs (File. lmd-dir))
- _ (write-file (str lmd-dir "/" lux-module-descriptor-name) (.getBytes descriptor java.nio.charset.StandardCharsets/UTF_8))]]
+ _ (write-file (str lmd-dir java.io.File/separator lux-module-descriptor-name) (.getBytes descriptor java.nio.charset.StandardCharsets/UTF_8))]]
(return nil)))
(defn read-module-descriptor! [^String name]
(|do [_ (return nil)]
- (return (slurp (str @!output-dir "/" name "/" lux-module-descriptor-name)
+ (return (slurp (str @!output-dir java.io.File/separator name java.io.File/separator lux-module-descriptor-name)
:encoding "UTF-8"))))
(do-template [<wrap-name> <unwrap-name> <class> <unwrap-method> <prim> <dup>]
diff --git a/luxc/src/lux/compiler/cache.clj b/luxc/src/lux/compiler/cache.clj
index 726ea784d..4bb144734 100644
--- a/luxc/src/lux/compiler/cache.clj
+++ b/luxc/src/lux/compiler/cache.clj
@@ -49,12 +49,18 @@
(defn cached? [module]
"(-> Text Bool)"
- (.exists (new File (str @&&/!output-dir "/" (&host/->module-class module) "/" module-class-file))))
+ (.exists (new File (str @&&/!output-dir
+ java.io.File/separator
+ (.replace ^String (&host/->module-class module) "/" java.io.File/separator)
+ java.io.File/separator
+ module-class-file))))
(defn delete [module]
"(-> Text (Lux Null))"
(fn [state]
- (do (clean-file (new File (str @&&/!output-dir "/" (&host/->module-class module))))
+ (do (clean-file (new File (str @&&/!output-dir
+ java.io.File/separator
+ (.replace ^String (&host/->module-class module) "/" java.io.File/separator))))
(return* state nil))))
(defn ^:private module-dirs
@@ -70,7 +76,7 @@
(defn clean [state]
"(-> Compiler Null)"
(let [needed-modules (->> state (&/get$ &/$modules) &/|keys &/->seq set)
- output-dir-prefix (str (.getAbsolutePath (new File ^String @&&/!output-dir)) "/")
+ output-dir-prefix (str (.getAbsolutePath (new File ^String @&&/!output-dir)) java.io.File/separator)
outdated? #(->> % (contains? needed-modules) not)
outdated-modules (->> (new File ^String @&&/!output-dir)
.listFiles (filter #(.isDirectory ^File %))
@@ -197,7 +203,9 @@
(->> output-dir
enumerate-cached-modules!*
rest
- (map #(.substring ^String % prefix-to-subtract))
+ (map #(-> ^String %
+ (.replace java.io.File/separator "/")
+ (.substring prefix-to-subtract)))
&/->list)))
(defn ^:private pre-load! [source-dirs cache-table module module-hash]
@@ -211,9 +219,9 @@
(|do [loader &/loader
!classes &/classes
:let [module* (&host-generics/->class-name module)
- module-path (str @&&/!output-dir "/" module)
+ module-path (str @&&/!output-dir java.io.File/separator module)
class-name (str module* "." &/module-class-name)
- ^Class module-class (do (swap! !classes assoc class-name (read-file (new File (str module-path "/" module-class-file))))
+ ^Class module-class (do (swap! !classes assoc class-name (read-file (new File (str module-path java.io.File/separator module-class-file))))
(&&/load-class! loader class-name))
installed-classes (install-all-classes-in-module !classes module* module-path)
valid-cache? (and (= module-hash (get-field &/hash-field module-class))
diff --git a/luxc/src/lux/compiler/io.clj b/luxc/src/lux/compiler/io.clj
index 179e2a097..12073a0a5 100644
--- a/luxc/src/lux/compiler/io.clj
+++ b/luxc/src/lux/compiler/io.clj
@@ -17,7 +17,7 @@
(defn read-file [source-dirs ^String file-name]
(|case (&/|some (fn [source-dir]
- (let [file (new java.io.File (str source-dir "/" file-name))]
+ (let [file (new java.io.File source-dir file-name)]
(if (.exists file)
(&/$Some file)
&/$None)))