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:
@@ -176,6 +176,13 @@ func (z *zipWriter) writeRelFile(root, file string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (z *zipWriter) writeFile(rel, 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 {
|
if z.directories {
|
||||||
dir, _ := filepath.Split(rel)
|
dir, _ := filepath.Split(rel)
|
||||||
err := z.writeDirectory(dir)
|
err := z.writeDirectory(dir)
|
||||||
|
Reference in New Issue
Block a user