Skip to content

Commit

Permalink
Merge pull request #390 from Zetten/enhance-is-dest-dir
Browse files Browse the repository at this point in the history
Improve IsDestDir functionality with filesystem info
  • Loading branch information
priyawadhwa authored Oct 12, 2018
2 parents effac9d + 073abff commit aabb97b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/util/command_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aabb97b

Please sign in to comment.