Merge pull request #390 from Zetten/enhance-is-dest-dir

Improve IsDestDir functionality with filesystem info
This commit is contained in:
priyawadhwa 2018-10-11 18:15:59 -07:00 committed by GitHub
commit aabb97b944
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -133,7 +133,14 @@ func matchSources(srcs, files []string) ([]string, error) {
}
func IsDestDir(path string) bool {
return strings.HasSuffix(path, "/") || path == "."
// try to stat the path
fileInfo, err := os.Stat(path)
if err != nil {
// fall back to string-based determination
return strings.HasSuffix(path, "/") || path == "."
}
// if it's a real path, check the fs response
return fileInfo.IsDir()
}
// DestinationFilepath returns the destination filepath from the build context to the image filesystem