MCPcopy Create free account
hub / github.com/VirusTotal/vt-cli / pathDepth

Function pathDepth

utils/file_utils.go:74–76  ·  view source on GitHub ↗

pathDepth returns the depth of a given path by counting its components. It uses filepath.Separator, which ensures correct behavior across all platforms (Windows, macOS, Linux), regardless of the underlying path separator.

(path string)

Source from the content-addressed store, hash-verified

72// It uses filepath.Separator, which ensures correct behavior across all platforms
73// (Windows, macOS, Linux), regardless of the underlying path separator.
74func pathDepth(path string) int {
75 return len(strings.Split(filepath.Clean(path), string(filepath.Separator)))
76}
77
78// IsDir function returns whether a file is a directory or not
79func IsDir(f string) bool {

Callers 2

NewFileDirReaderFunction · 0.85
Test_pathDepthFunction · 0.85

Calls

no outgoing calls

Tested by 1

Test_pathDepthFunction · 0.68