Skip to content

Commit 883b277

Browse files
committed
move tool init at the top so that .arduino-create/ is created
1 parent d28cb56 commit 883b277

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

main.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,18 @@ func main() {
140140
// Parse regular flags
141141
flag.Parse()
142142

143+
// Instantiate Tools, so that .arduino-create/ folder gets created
144+
Tools = tools.Tools{
145+
Directory: agentDir.String(),
146+
IndexURL: *indexURL,
147+
Logger: func(msg string) {
148+
mapD := map[string]string{"DownloadStatus": "Pending", "Msg": msg}
149+
mapB, _ := json.Marshal(mapD)
150+
h.broadcastSys <- mapB
151+
},
152+
}
153+
Tools.Init(requiredToolsAPILevel)
154+
143155
// Generate certificates
144156
if *genCert {
145157
generateCertificates()
@@ -201,18 +213,6 @@ func loop() {
201213
log.SetLevel(log.InfoLevel)
202214
log.SetOutput(os.Stdout)
203215

204-
// Instantiate Tools
205-
Tools = tools.Tools{
206-
Directory: agentDir.String(),
207-
IndexURL: *indexURL,
208-
Logger: func(msg string) {
209-
mapD := map[string]string{"DownloadStatus": "Pending", "Msg": msg}
210-
mapB, _ := json.Marshal(mapD)
211-
h.broadcastSys <- mapB
212-
},
213-
}
214-
Tools.Init(requiredToolsAPILevel)
215-
216216
// Let's handle the config
217217
var configPath *paths.Path
218218

0 commit comments

Comments
 (0)