diff options
-rw-r--r-- | new-luxc/source/luxc/io.jvm.lux | 17 |
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)) |