mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-05-23 16:40:08 -03:00
patch IsDotFile function compatible with both '.' and '..'
Signed-off-by: Huitse Tai <geb.1989@gmail.com>
This commit is contained in:
parent
887bc6a4be
commit
a786f6175e
3
utils.go
3
utils.go
@ -40,8 +40,9 @@ func IsConfiguration(path string) bool {
|
|||||||
|
|
||||||
// IsDotFile returns whether or not path has dot as a prefix.
|
// IsDotFile returns whether or not path has dot as a prefix.
|
||||||
func IsDotFile(path string) bool {
|
func IsDotFile(path string) bool {
|
||||||
|
path = filepath.Clean(path)
|
||||||
base := filepath.Base(path)
|
base := filepath.Base(path)
|
||||||
return strings.HasPrefix(base, ".") && len(base) > len(".")
|
return strings.HasPrefix(base, ".") && base != "." && base != ".."
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsVendor returns whether or not path is a vendor path.
|
// IsVendor returns whether or not path is a vendor path.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user