1818package root
1919
2020import (
21+ "fmt"
2122 "io/ioutil"
2223 "os"
24+ "path/filepath"
2325
2426 "github.com/arduino/arduino-cli/output"
2527
@@ -115,6 +117,7 @@ func preRun(cmd *cobra.Command, args []string) {
115117
116118// initConfigs initializes the configuration from the specified file.
117119func initConfigs () {
120+ // Start with default configuration
118121 if conf , err := configs .NewConfiguration (); err != nil {
119122 logrus .WithError (err ).Error ("Error creating default configuration" )
120123 formatter .PrintError (err , "Error creating default configuration" )
@@ -123,14 +126,25 @@ func initConfigs() {
123126 commands .Config = conf
124127 }
125128
129+ // Navigate through folders
130+ pwd , err := filepath .Abs ("." )
131+ if err != nil {
132+ logrus .WithError (err ).Warn ("Did not manage to find current path" )
133+ }
134+
135+ commands .Config .Navigate ("/" , pwd )
136+
137+ fmt .Println (yamlConfigFile )
138+
126139 if yamlConfigFile != "" {
127140 commands .Config .ConfigFile = paths .New (yamlConfigFile )
141+ if err := commands .Config .LoadFromYAML (commands .Config .ConfigFile ); err != nil {
142+ logrus .WithError (err ).Warn ("Did not manage to get config file, using default configuration" )
143+ }
128144 }
129145
130146 logrus .Info ("Initiating configuration" )
131- if err := commands .Config .LoadFromYAML (commands .Config .ConfigFile ); err != nil {
132- logrus .WithError (err ).Warn ("Did not manage to get config file, using default configuration" )
133- }
147+
134148 if commands .Config .IsBundledInDesktopIDE () {
135149 logrus .Info ("CLI is bundled into the IDE" )
136150 err := commands .Config .LoadFromDesktopIDEPreferences ()
0 commit comments