Add missing os.MkdirAll to WriteFileToOutputDir
Fix tests when out/soong doesn't already exist by adding os.MkdirAll to WriteFileToOutputDir. Test: soong tests Change-Id: I2a2b10e43b967d0c61d0dbe6a3f8bf381babe73c
This commit is contained in:
parent
836e387323
commit
d642113643
1 changed files with 6 additions and 1 deletions
|
@ -2058,7 +2058,12 @@ func maybeRelErr(basePath string, targetPath string) (string, bool, error) {
|
|||
// Writes a file to the output directory. Attempting to write directly to the output directory
|
||||
// will fail due to the sandbox of the soong_build process.
|
||||
func WriteFileToOutputDir(path WritablePath, data []byte, perm os.FileMode) error {
|
||||
return ioutil.WriteFile(absolutePath(path.String()), data, perm)
|
||||
absPath := absolutePath(path.String())
|
||||
err := os.MkdirAll(filepath.Dir(absPath), 0777)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return ioutil.WriteFile(absPath, data, perm)
|
||||
}
|
||||
|
||||
func RemoveAllOutputDir(path WritablePath) error {
|
||||
|
|
Loading…
Reference in a new issue