Skip to content

Commit

Permalink
Merge pull request Azure#364 from magodo/output_dir_create
Browse files Browse the repository at this point in the history
Mkdir for output dir if not exists
  • Loading branch information
stemaMSFT committed Feb 28, 2023
2 parents aa2c01b + 0d75655 commit bfd11b2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ func main() {
}

// Initialize output directory
if _, err := os.Stat(flagOutputDir); os.IsNotExist(err) {
if err := os.MkdirAll(flagOutputDir, 0750); err != nil {
return fmt.Errorf("creating output directory %q: %v", flagOutputDir, err)
}
}
empty, err := utils.DirIsEmpty(flagOutputDir)
if err != nil {
return fmt.Errorf("failed to check emptiness of output directory %q: %v", flagOutputDir, err)
Expand Down Expand Up @@ -266,7 +271,7 @@ The output directory is not empty. Please choose one of actions below:
Name: "output-dir",
EnvVars: []string{"AZTFY_OUTPUT_DIR"},
Aliases: []string{"o"},
Usage: "The output directory",
Usage: "The output directory (will create if not exists)",
Value: func() string {
dir, _ := os.Getwd()
return dir
Expand Down

0 comments on commit bfd11b2

Please sign in to comment.