func createDir()

in pkg/config/config.go [76:91]


func createDir(dir string) error {
	f, err := os.Stat(dir)

	// create dir if not exists
	if os.IsNotExist(err) {
		if err := os.Mkdir(dir, 0755); err != nil {
			return fmt.Errorf("Failed to create directory for final configuration at %s: %s", dir, err)
		}
	} else {
		// make sure the dir exists
		if !f.IsDir() {
			return fmt.Errorf("The destination '%s' for saving the configuration already exists, but is not a directory", dir)
		}
	}
	return nil
}