fix(local): Treat junction as directory in Windows. (#809)

Treat junction as directory in Windows.
This commit is contained in:
Rambin
2025-07-31 13:54:56 +08:00
committed by GitHub
parent 9469c95b14
commit a5a22e7085

View File

@ -7,6 +7,7 @@ import (
"io/fs" "io/fs"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
@ -19,7 +20,8 @@ import (
) )
func isSymlinkDir(f fs.FileInfo, path string) bool { func isSymlinkDir(f fs.FileInfo, path string) bool {
if f.Mode()&os.ModeSymlink == os.ModeSymlink { if f.Mode()&os.ModeSymlink == os.ModeSymlink ||
(runtime.GOOS == "windows" && f.Mode()&os.ModeIrregular == os.ModeIrregular) { // os.ModeIrregular is Junction bit in Windows
dst, err := os.Readlink(filepath.Join(path, f.Name())) dst, err := os.Readlink(filepath.Join(path, f.Name()))
if err != nil { if err != nil {
return false return false