mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2025-09-19 04:06:18 +08:00
fix(local): Treat junction as directory in Windows. (#809)
Treat junction as directory in Windows.
This commit is contained in:
@ -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
|
||||||
|
Reference in New Issue
Block a user