Skip to content

Commit

Permalink
Exit with error if it can't create the directory metafates#195
Browse files Browse the repository at this point in the history
  • Loading branch information
Telmo committed Dec 6, 2024
1 parent 847c545 commit b017c64
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions where/where.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
package where

import (
"log"
"os"
"path/filepath"

"github.com/metafates/mangal/constant"
"github.com/metafates/mangal/filesystem"
"github.com/metafates/mangal/key"
"github.com/samber/lo"
"github.com/spf13/viper"
"os"
"path/filepath"
)

const EnvConfigPath = "MANGAL_CONFIG_PATH"

// mkdir creates a directory and all parent directories if they don't exist
// will return the path of the directory
func mkdir(path string) string {
lo.Must0(filesystem.Api().MkdirAll(path, os.ModePerm))
if filesystem.Api().MkdirAll(path, os.ModePerm) != nil {
log.Fatalf("Error: could not create directory %s", path)
}
return path
}

Expand Down

0 comments on commit b017c64

Please sign in to comment.