Skip to content
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
22 changes: 18 additions & 4 deletions packages/core/src/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,24 @@ export namespace AppFileSystem {
return yield* Effect.tryPromise({
try: async () => {
const entries = await NFS.readdir(dirPath, { withFileTypes: true })
return entries.map(
(e): DirEntry => ({
name: e.name,
type: e.isDirectory() ? "directory" : e.isSymbolicLink() ? "symlink" : e.isFile() ? "file" : "other",
return await Promise.all(
entries.map(async (e): Promise<DirEntry> => {
let type: DirEntry["type"]
if (e.isDirectory()) {
type = "directory"
} else if (e.isSymbolicLink()) {
try {
const target = await NFS.stat(join(dirPath, e.name))
type = target.isDirectory() ? "directory" : "symlink"
} catch {
type = "symlink"
}
} else if (e.isFile()) {
type = "file"
} else {
type = "other"
}
return { name: e.name, type }
}),
)
Comment on lines +71 to 90
Comment on lines +71 to 90
},
Expand Down
Loading