From b83ef3a5cfeb863d297cdffc232b5eb85daa7347 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 3 Jan 2018 23:54:59 -0400 Subject: - Fixed a bug when creating directories during compilation. --- new-luxc/source/luxc/io.jvm.lux | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'new-luxc/source/luxc/io.jvm.lux') 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 - [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)) -- cgit v1.2.3