Skip to content

Commit 7b29ce7

Browse files
committed
fix(filesystem): resolve symlink/junction targets to directory type in readDirectoryEntries
When isSymbolicLink() is true (Linux symlinks, Windows junction points like OneDrive Desktop), stat() the target to determine if it points to a directory. Previously these entries were classified as 'symlink' and silently filtered out by downstream code (file/index.ts), making symlinked directories invisible in the project picker, @file picker, and file listing on ALL platforms. This fixes the root cause instead of patching individual filter sites. Closes anomalyco#28526, also resolves anomalyco#10365 and anomalyco#16342.
1 parent 08b1301 commit 7b29ce7

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

‎packages/core/src/filesystem.ts‎

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,24 @@ export namespace AppFileSystem {
6868
return yield* Effect.tryPromise({
6969
try: async () => {
7070
const entries = await NFS.readdir(dirPath, { withFileTypes: true })
71-
return entries.map(
72-
(e): DirEntry => ({
73-
name: e.name,
74-
type: e.isDirectory() ? "directory" : e.isSymbolicLink() ? "symlink" : e.isFile() ? "file" : "other",
71+
return await Promise.all(
72+
entries.map(async (e): Promise<DirEntry> => {
73+
let type: DirEntry["type"]
74+
if (e.isDirectory()) {
75+
type = "directory"
76+
} else if (e.isSymbolicLink()) {
77+
try {
78+
const target = await NFS.stat(join(dirPath, e.name))
79+
type = target.isDirectory() ? "directory" : "symlink"
80+
} catch {
81+
type = "symlink"
82+
}
83+
} else if (e.isFile()) {
84+
type = "file"
85+
} else {
86+
type = "other"
87+
}
88+
return { name: e.name, type }
7589
}),
7690
)
7791
},

0 commit comments

Comments
 (0)