Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reverted a broken AI refractor, improved previous method of file checking #1863

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions pkg/util/fileutil/fileutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,19 @@ const (

func WinSymlinkDir(path string, bits os.FileMode) bool {
// Windows compatibility layer doesn't expose symlink target type through fileInfo
// so we need to check file attributes and extension patterns
// so we need to over-engineer a bit
isFileSymlink := func(filepath string) bool {
if len(filepath) == 0 {
return false
Length, dirIndex := len(filepath)-1, strings.LastIndex(filepath, "\\")
for i := Length; i > dirIndex; i-- {
if filepath[i] == '.' {
// here to catch directories like .shared / .config
if i-1 == dirIndex {
break
}
return true
}
}
return strings.LastIndex(filepath, ".") > strings.LastIndex(filepath, "/")
return false
}

flags := uint32(bits >> 12)
Expand Down