Skip to content

Commit 76702ff

Browse files
committed
Print a friendly message if a tool is not available
See arduino#755
1 parent bf4042e commit 76702ff

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Diff for: arduino/cores/tools.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ func (tr *ToolRelease) String() string {
133133
// RuntimeProperties returns the runtime properties for this tool
134134
func (tr *ToolRelease) RuntimeProperties() *properties.Map {
135135
res := properties.NewMap()
136-
res.Set("runtime.tools."+tr.Tool.Name+".path", tr.InstallDir.String())
137-
res.Set("runtime.tools."+tr.Tool.Name+"-"+tr.Version.String()+".path", tr.InstallDir.String())
136+
if tr.IsInstalled() {
137+
res.Set("runtime.tools."+tr.Tool.Name+".path", tr.InstallDir.String())
138+
res.Set("runtime.tools."+tr.Tool.Name+"-"+tr.Version.String()+".path", tr.InstallDir.String())
139+
}
138140
return res
139141
}
140142

Diff for: commands/upload/upload.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,11 @@ func runProgramAction(pm *packagemanager.PackageManager,
193193
if requiredTools, err := pm.FindToolsRequiredForBoard(board); err == nil {
194194
for _, requiredTool := range requiredTools {
195195
logrus.WithField("tool", requiredTool).Info("Tool required for upload")
196-
uploadProperties.Merge(requiredTool.RuntimeProperties())
196+
if requiredTool.IsInstalled() {
197+
uploadProperties.Merge(requiredTool.RuntimeProperties())
198+
} else {
199+
errStream.Write([]byte(fmt.Sprintf("Warning: tool '%s' is not installed. It might not be available for your OS.", requiredTool)))
200+
}
197201
}
198202
}
199203

0 commit comments

Comments
 (0)