@@ -178,14 +178,11 @@ func (t *Tools) Download(pack, name, version, behaviour string) error {
178
178
var data index
179
179
json .Unmarshal (body , & data )
180
180
181
- t .Logger .Println (string (body ))
182
-
183
181
// Find the tool by name
184
182
correctTool , correctSystem := findTool (pack , name , version , data )
185
183
186
184
if correctTool .Name == "" || correctSystem .URL == "" {
187
- t .Logger .Println ("We couldn't find a tool with the name " + name + " and version " + version + " packaged by " + pack )
188
- return nil
185
+ return errors .New ("We couldn't find a tool with the name " + name + " and version " + version + " packaged by " + pack )
189
186
}
190
187
191
188
key := correctTool .Name + "-" + correctTool .Version
@@ -196,13 +193,13 @@ func (t *Tools) Download(pack, name, version, behaviour string) error {
196
193
if ok && pathExists (location ) {
197
194
// overwrite the default tool with this one
198
195
t .installed [correctTool .Name ] = location
199
- t .Logger . Println ("The tool is already present on the system" )
196
+ t .Logger ("The tool is already present on the system" )
200
197
return t .writeMap ()
201
198
}
202
199
}
203
200
204
201
// Download the tool
205
- t .Logger . Println ("Downloading tool " + name + " from " + correctSystem .URL )
202
+ t .Logger ("Downloading tool " + name + " from " + correctSystem .URL )
206
203
resp , err := http .Get (correctSystem .URL )
207
204
if err != nil {
208
205
return err
@@ -224,7 +221,7 @@ func (t *Tools) Download(pack, name, version, behaviour string) error {
224
221
}
225
222
226
223
// Decompress
227
- t .Logger . Println ("Unpacking tool " + name )
224
+ t .Logger ("Unpacking tool " + name )
228
225
229
226
location := path .Join (dir (), pack , correctTool .Name , correctTool .Version )
230
227
err = os .RemoveAll (location )
@@ -251,7 +248,7 @@ func (t *Tools) Download(pack, name, version, behaviour string) error {
251
248
}
252
249
253
250
if err != nil {
254
- t .Logger . Println ("Error extracting the archive: " , err .Error ())
251
+ t .Logger ("Error extracting the archive: " + err .Error ())
255
252
return err
256
253
}
257
254
@@ -261,10 +258,10 @@ func (t *Tools) Download(pack, name, version, behaviour string) error {
261
258
}
262
259
263
260
// Ensure that the files are executable
264
- t .Logger . Println ("Ensure that the files are executable" )
261
+ t .Logger ("Ensure that the files are executable" )
265
262
266
263
// Update the tool map
267
- t .Logger . Println ("Updating map with location " + location )
264
+ t .Logger ("Updating map with location " + location )
268
265
269
266
t .installed [name ] = location
270
267
t .installed [name + "-" + correctTool .Version ] = location
@@ -455,19 +452,17 @@ func (t *Tools) installDrivers(location string) error {
455
452
preamble = "./"
456
453
}
457
454
if _ , err := os .Stat (filepath .Join (location , "post_install" + extension )); err == nil {
458
- t .Logger . Println ("Installing drivers" )
455
+ t .Logger ("Installing drivers" )
459
456
ok := MessageBox ("Installing drivers" , "We are about to install some drivers needed to use Arduino/Genuino boards\n Do you want to continue?" )
460
- t .Logger .Println (ok )
461
457
if ok == OK_PRESSED {
462
458
os .Chdir (location )
459
+ t .Logger (preamble + "post_install" + extension )
463
460
oscmd := exec .Command (preamble + "post_install" + extension )
464
461
if runtime .GOOS != "linux" {
465
462
// spawning a shell could be the only way to let the user type his password
466
463
TellCommandNotToSpawnShell (oscmd )
467
464
}
468
- t .Logger .Println (oscmd )
469
465
err = oscmd .Run ()
470
- t .Logger .Println (err )
471
466
return err
472
467
} else {
473
468
return errors .New ("Could not install drivers" )
0 commit comments