Skip to content

Commit db125c5

Browse files
author
Gogs
committed
isLink util
1 parent 0b3a3cb commit db125c5

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

utils.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,16 @@ func isFile(filePath string) bool {
5656
if e != nil {
5757
return false
5858
}
59-
return !f.IsDir()
59+
return f.IsRegular()
60+
}
61+
62+
// IsLink returns true if the given path is a symlink
63+
func isLink(path string) bool {
64+
f, e := os.Lstat(path)
65+
if e != nil {
66+
return false
67+
}
68+
return (f.Mode() & os.ModeSymlink == os.ModeSymlink)
6069
}
6170

6271
// isExist checks whether a file or directory exists.

0 commit comments

Comments
 (0)