summaryrefslogtreecommitdiff
path: root/crocc.go
diff options
context:
space:
mode:
authorNicolas Paul <n@nc0.fr>2023-04-26 22:16:03 +0200
committerNicolas Paul <n@nc0.fr>2023-04-26 22:16:03 +0200
commit8ad06294d6d9c7a67a32099e31c93b4f08b9aff2 (patch)
tree02edb46f1f283cca6df8d115c97096d97b1baae6 /crocc.go
parent8f4d8fbc593dfa3dfcf4ad132d01f23cffda360c (diff)
Fix missing outdir bug
crocc was not creating the output directory if it was not present, making it impossible to generate files
Diffstat (limited to 'crocc.go')
-rw-r--r--crocc.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/crocc.go b/crocc.go
index 4e6d48d..266b816 100644
--- a/crocc.go
+++ b/crocc.go
@@ -81,6 +81,10 @@ func main() {
// Check output directory
if _, err := os.Stat(*out); !os.IsNotExist(err) {
log.Fatalf("output directory %q already exists", *out)
+ } else {
+ if err := os.MkdirAll(*out, 0755); err != nil {
+ log.Fatalf("unable to create output directory %q: %v", *out, err)
+ }
}
// Retrieve template file