18
18
package root
19
19
20
20
import (
21
+ "fmt"
21
22
"io/ioutil"
22
23
"os"
24
+ "path/filepath"
23
25
24
26
"github.com/arduino/arduino-cli/output"
25
27
@@ -115,6 +117,7 @@ func preRun(cmd *cobra.Command, args []string) {
115
117
116
118
// initConfigs initializes the configuration from the specified file.
117
119
func initConfigs () {
120
+ // Start with default configuration
118
121
if conf , err := configs .NewConfiguration (); err != nil {
119
122
logrus .WithError (err ).Error ("Error creating default configuration" )
120
123
formatter .PrintError (err , "Error creating default configuration" )
@@ -123,14 +126,25 @@ func initConfigs() {
123
126
commands .Config = conf
124
127
}
125
128
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
+
126
139
if yamlConfigFile != "" {
127
140
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
+ }
128
144
}
129
145
130
146
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
+
134
148
if commands .Config .IsBundledInDesktopIDE () {
135
149
logrus .Info ("CLI is bundled into the IDE" )
136
150
err := commands .Config .LoadFromDesktopIDEPreferences ()
0 commit comments