We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9061584 commit 78c6480Copy full SHA for 78c6480
cli/config/init.go
@@ -49,7 +49,13 @@ var initFlags struct {
49
func runInitCommand(cmd *cobra.Command, args []string) {
50
logrus.Info("Executing `arduino config init`")
51
52
- configFile := filepath.Join(viper.GetString("directories.Data"), "arduino-cli.yaml")
+ dataDir := viper.GetString("directories.Data")
53
+ if err := os.MkdirAll(dataDir, os.FileMode(0755)); err != nil {
54
+ feedback.Errorf("Cannot create data directory: %v", err)
55
+ os.Exit(errorcodes.ErrGeneric)
56
+ }
57
+
58
+ configFile := filepath.Join(dataDir, "arduino-cli.yaml")
59
err := viper.WriteConfigAs(configFile)
60
if err != nil {
61
feedback.Errorf("Cannot create config file: %v", err)
0 commit comments