Resolve symlinks to determine file type

This commit is contained in:
raul 2024-06-17 13:25:21 +02:00
parent ac188a4dae
commit 7078068435
1 changed files with 10 additions and 1 deletions

11
main.go
View File

@ -146,10 +146,19 @@ func listFiles(conn net.Conn, rpath string) {
newList := FileList{}
for _, v := range list {
var isDir bool
f, err := os.Stat(path + v.Name())
if err != nil {
continue
}
if f.IsDir() == true {
isDir = true
}
item := Item{
Name: v.Name(),
FullPath: path + v.Name(),
IsFolder: v.IsDir(),
IsFolder: isDir,
}
newList.File = append(newList.File, item)
}