Skip to content

Commit 7feefe7

Browse files
committed
Replace the runtime variables until they exist
1 parent 450f7db commit 7feefe7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

programmer.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,15 @@ func spProgramLocal(portname string, boardname string, filePath string, commandl
227227

228228
log.Printf("Received commandline (unresolved):" + commandline)
229229

230-
commandline = strings.Replace(commandline, "{build.path}", filepath.ToSlash(filepath.Dir(filePath)), 1)
231-
commandline = strings.Replace(commandline, "{build.project_name}", strings.TrimSuffix(filepath.Base(filePath), filepath.Ext(filepath.Base(filePath))), 1)
232-
commandline = strings.Replace(commandline, "{serial.port}", portname, 1)
233-
commandline = strings.Replace(commandline, "{serial.port.file}", filepath.Base(portname), 1)
230+
commandline = strings.Replace(commandline, "{build.path}", filepath.ToSlash(filepath.Dir(filePath)), -1)
231+
commandline = strings.Replace(commandline, "{build.project_name}", strings.TrimSuffix(filepath.Base(filePath), filepath.Ext(filepath.Base(filePath))), -1)
232+
commandline = strings.Replace(commandline, "{serial.port}", portname, -1)
233+
commandline = strings.Replace(commandline, "{serial.port.file}", filepath.Base(portname), -1)
234234

235235
if extraInfo.Verbose == true {
236-
commandline = strings.Replace(commandline, "{upload.verbose}", extraInfo.ParamsVerbose, 1)
236+
commandline = strings.Replace(commandline, "{upload.verbose}", extraInfo.ParamsVerbose, -1)
237237
} else {
238-
commandline = strings.Replace(commandline, "{upload.verbose}", extraInfo.ParamsQuiet, 1)
238+
commandline = strings.Replace(commandline, "{upload.verbose}", extraInfo.ParamsQuiet, -1)
239239
}
240240

241241
// search for runtime variables and replace with values from globalToolsMap

0 commit comments

Comments
 (0)