chore: make webfs usable

This commit is contained in:
binekrasik
2026-05-17 23:52:31 +02:00
parent f8335dcf5f
commit 4f4b72b915
14 changed files with 81 additions and 34 deletions

View File

@@ -8,12 +8,20 @@ export class Mkdir extends Program {
}
async Exec(_: SimpleStream<string>, stdout: SimpleStream<string>, workdir: Item, args: string[]): Promise<number> {
const item = await Item.openDir(args[1])
if (args.length < 2) {
stdout.emit("mkdir: error: missing path argument\n")
return 1
}
const item = await Item.openDir(args[1].startsWith('/')
? args[1]
: `${workdir.GetPath()}${workdir.GetPath().endsWith('/') ? '' : '/'}${args[1]}`)
stdout.emit(`does ${args[1]} exist? ${await item.Exists()}\n`)
if (await item.Exists()) {
stdout.emit(`mkdir: directory ${item.GetPath()} already exists.\n`)
return 1
return 2
}
item.Create()