Skip to content

Commit 17b2af5

Browse files
committed
Return an error message when there's a old configuration file
1 parent 61dfa2a commit 17b2af5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

commands/root/root.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package root
1919

2020
import (
21+
"fmt"
2122
"io/ioutil"
2223
"os"
2324
"path/filepath"
@@ -116,6 +117,12 @@ func preRun(cmd *cobra.Command, args []string) {
116117

117118
// initConfigs initializes the configuration from the specified file.
118119
func initConfigs() {
120+
// Return error if an old configuration file is found
121+
if paths.New(".cli-config.yml").Exist() {
122+
logrus.Error("Old configuration file detected. Ensure you are using the new `arduino-cli.yaml` configuration")
123+
formatter.PrintError(fmt.Errorf("old configuration file detected"), "Ensure you are using the new `arduino-cli.yaml` configuration")
124+
os.Exit(commands.ErrGeneric)
125+
}
119126
// Start with default configuration
120127
if conf, err := configs.NewConfiguration(); err != nil {
121128
logrus.WithError(err).Error("Error creating default configuration")

0 commit comments

Comments
 (0)