From 8ad06294d6d9c7a67a32099e31c93b4f08b9aff2 Mon Sep 17 00:00:00 2001 From: Nicolas Paul Date: Wed, 26 Apr 2023 22:16:03 +0200 Subject: Fix missing outdir bug crocc was not creating the output directory if it was not present, making it impossible to generate files --- crocc.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crocc.go') 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 -- cgit v1.2.3