mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-17 03:03:27 +00:00
Ensure build output directory is created
`tinygo build -o /path/to/out .` expected `/path/to/out` to already exist, which is different behaviour to `go build`. This change ensures tinygo creates any directories needed to be able to build to the specified output dir.
This commit is contained in:
committed by
Ron Evans
parent
f02c56c9e0
commit
c1b267a208
@@ -604,6 +604,11 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create the output directory, if needed
|
||||||
|
if err := os.MkdirAll(filepath.Dir(outpath), 0777); err != nil {
|
||||||
|
return result, err
|
||||||
|
}
|
||||||
|
|
||||||
// Check whether we only need to create an object file.
|
// Check whether we only need to create an object file.
|
||||||
// If so, we don't need to link anything and will be finished quickly.
|
// If so, we don't need to link anything and will be finished quickly.
|
||||||
outext := filepath.Ext(outpath)
|
outext := filepath.Ext(outpath)
|
||||||
|
|||||||
Reference in New Issue
Block a user