Merge pull request #390 from Zetten/enhance-is-dest-dir
Improve IsDestDir functionality with filesystem info
This commit is contained in:
commit
aabb97b944
|
|
@ -133,8 +133,15 @@ func matchSources(srcs, files []string) ([]string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsDestDir(path string) bool {
|
func IsDestDir(path string) bool {
|
||||||
|
// try to stat the path
|
||||||
|
fileInfo, err := os.Stat(path)
|
||||||
|
if err != nil {
|
||||||
|
// fall back to string-based determination
|
||||||
return strings.HasSuffix(path, "/") || path == "."
|
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
|
// DestinationFilepath returns the destination filepath from the build context to the image filesystem
|
||||||
// If source is a file:
|
// If source is a file:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue