ADDED:
* paths:
** IsDirOrLinkDir
This commit is contained in:
brent saner
2026-07-17 17:22:03 -04:00
parent 8e70ffac38
commit 8f1fca839c
+23
View File
@@ -161,6 +161,29 @@ func GetFirstWithRef(p []string) (content []byte, isDir, ok bool, idx int) {
return 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]. Len returns the number of path segments in p, as split with the same param signature to [Segment].