v1.16.4
ADDED: * paths: ** IsDirOrLinkDir
This commit is contained in:
@@ -161,6 +161,29 @@ func GetFirstWithRef(p []string) (content []byte, isDir, ok bool, idx int) {
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
IsDirOrLinkDir returns true if path p is a directory OR a symlink to a directory.
|
||||
|
||||
isDir will be true if p is either a directory or a symlink directory
|
||||
(symlinks are followed and recursed).
|
||||
|
||||
isLink will only be true if p is a symlink to a directory (or a symlink to a symlink
|
||||
to a directory, etc.).
|
||||
*/
|
||||
func IsDirOrLinkDir(p string) (isDir, isLink bool, err error) {
|
||||
|
||||
var stat fs.FileInfo
|
||||
var pTmp string = p // avoid weird runtime-y race-y things
|
||||
|
||||
if _, _, isLink, _, stat, err = RealPathExistsStatTarget(&pTmp); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
isDir = stat.IsDir()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
Len returns the number of path segments in p, as split with the same param signature to [Segment].
|
||||
|
||||
|
||||
Reference in New Issue
Block a user