Skip to content

Commit 667671a

Browse files
facchinmcmaglie
authored andcommitted
Avoid setting build_cache path if not specified
Fixes arduino/Arduino#9189 Also, creates the directory if nonexistent.
1 parent bc2846e commit 667671a

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

main.go

+10-14
Original file line numberDiff line numberDiff line change
@@ -319,23 +319,19 @@ func main() {
319319
}
320320

321321
// FLAG_BUILD_CACHE
322-
buildCachePathUnquoted, err := gohasissues.Unquote(*buildCachePathFlag)
323-
if err != nil {
324-
printCompleteError(err)
325-
}
326-
buildCachePath := paths.New(buildCachePathUnquoted)
327-
if buildCachePath != nil {
328-
// TODO: mmmmhhh... this one looks like a bug, why check existence?
329-
if _, err := buildCachePath.Stat(); err != nil {
330-
fmt.Fprintln(os.Stderr, err)
331-
os.Exit(1)
332-
}
333-
334-
if err := buildCachePath.MkdirAll(); err != nil {
322+
if *buildCachePathFlag != "" {
323+
buildCachePathUnquoted, err := gohasissues.Unquote(*buildCachePathFlag)
324+
if err != nil {
335325
printCompleteError(err)
336326
}
327+
buildCachePath := paths.New(buildCachePathUnquoted)
328+
if buildCachePath != nil {
329+
if err := buildCachePath.MkdirAll(); err != nil {
330+
printCompleteError(err)
331+
}
332+
}
333+
ctx.BuildCachePath = buildCachePath
337334
}
338-
ctx.BuildCachePath = buildCachePath
339335

340336
// FLAG_VID_PID
341337
if *vidPidFlag != "" {

0 commit comments

Comments
 (0)