MCPcopy
hub / github.com/wavetermdev/waveterm / WinSymlinkDir

Function WinSymlinkDir

pkg/util/fileutil/fileutil.go:76–95  ·  view source on GitHub ↗
(path string, bits os.FileMode)

Source from the content-addressed store, hash-verified

74)
75
76func WinSymlinkDir(path string, bits os.FileMode) bool {
77 // Windows compatibility layer doesn't expose symlink target type through fileInfo
78 // so we need to check file attributes and extension patterns
79 isFileSymlink := func(filepath string) bool {
80 if len(filepath) == 0 {
81 return false
82 }
83 return strings.LastIndex(filepath, ".") > strings.LastIndex(filepath, "/")
84 }
85
86 flags := uint32(bits >> 12)
87
88 if flags == winFlagSoftlink {
89 return !isFileSymlink(path)
90 } else if flags == winFlagJunction {
91 return true
92 } else {
93 return false
94 }
95}
96
97// on error just returns ""
98// does not return "application/octet-stream" as this is considered a detection failure

Callers 1

DetectMimeTypeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected