aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Julian2018-01-03 23:54:59 -0400
committerEduardo Julian2018-01-03 23:54:59 -0400
commitb83ef3a5cfeb863d297cdffc232b5eb85daa7347 (patch)
treefbf0173577364e1de9ac659eb563829532890479
parentae82d95e65aee8073b6192695be8efbdc7218a1b (diff)
- Fixed a bug when creating directories during compilation.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/io.jvm.lux17
1 files changed, 10 insertions, 7 deletions
diff --git a/new-luxc/source/luxc/io.jvm.lux b/new-luxc/source/luxc/io.jvm.lux
index c932472f3..0139edc7b 100644
--- a/new-luxc/source/luxc/io.jvm.lux
+++ b/new-luxc/source/luxc/io.jvm.lux
@@ -19,7 +19,7 @@
(exception: #export File-Not-Found)
(exception: #export Module-Not-Found)
-(exception: #export Cannot-Prepare-Module)
+(exception: #export Could-Not-Prepare-Module)
(def: sanitize
(-> Text Text)
@@ -79,14 +79,17 @@
(def: #export (prepare-module target-dir module-name)
(-> File Text (Process Unit))
(do io.Monad<Process>
- [made-dir? (|> module-name
- (format (platform-target target-dir) "/")
- sanitize
- file.make-dir)]
+ [#let [module-path (|> module-name
+ (format (platform-target target-dir) "/")
+ sanitize)]
+ module-exists? (file.exists? module-path)
+ made-dir? (if module-exists?
+ (wrap module-exists?)
+ (file.make-dir module-path))]
(if made-dir?
(wrap [])
- (io.fail (Cannot-Prepare-Module (format "Module: " module-name "\n"
- "Target: " target-dir "\n"))))))
+ (io.fail (Could-Not-Prepare-Module (format "Module: " module-name "\n"
+ "Target: " target-dir "\n"))))))
(def: #export (write target name content)
(-> File Text Blob (Process Unit))