soong_jar: ignore directories passed to jar unless -d is set
Java resource lists created by globs like "**/*" may include directories. Ignore them when creating the zip file unless -d was passed on the command line. Fixes read: is a directory errors. Change-Id: Ifa6fd4fbd8262f700bed1f4a7268f11618dc305c
This commit is contained in:
parent
e19c79310d
commit
957cc4e20d
1 changed files with 7 additions and 0 deletions
|
@ -176,6 +176,13 @@ func (z *zipWriter) writeRelFile(root, file string) error {
|
|||
}
|
||||
|
||||
func (z *zipWriter) writeFile(rel, file string) error {
|
||||
if s, _ := os.Stat(file); s.IsDir() {
|
||||
if z.directories {
|
||||
return z.writeDirectory(file)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
if z.directories {
|
||||
dir, _ := filepath.Split(rel)
|
||||
err := z.writeDirectory(dir)
|
||||
|
|
Loading…
Reference in a new issue