Skip to content

Commit d99df41

Browse files
Paolo Calaopolldo
Paolo Calao
authored andcommitted
Make arduino15 if not exist (#84)
During 'config init' if the default arduino directory (arduino15) doesn't exist then we're going to create it rather than returning an error
1 parent df6ea6e commit d99df41

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: cli/config/init.go

+7
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ func runInitCommand(cmd *cobra.Command, args []string) {
6565
feedback.Errorf("Error during config init: cannot retrieve arduino default directory: %v", err)
6666
os.Exit(errorcodes.ErrGeneric)
6767
}
68+
// Create arduino default directory if it does not exist
69+
if configPath.NotExist() {
70+
if err = configPath.MkdirAll(); err != nil {
71+
feedback.Errorf("Error during config init: cannot create arduino default directory %s: %v", configPath, err)
72+
os.Exit(errorcodes.ErrGeneric)
73+
}
74+
}
6875
initFlags.destDir = configPath.String()
6976
}
7077

0 commit comments

Comments
 (0)