From 4f3df58ff4573801f2e688979d3f67f6de7c3a8e Mon Sep 17 00:00:00 2001 From: rhpidfyre Date: Tue, 25 Feb 2025 21:13:08 -0500 Subject: [PATCH] move the fs tree into `tree.ts` out of `core.ts` --- src/rt/shell/fs/core.ts | 17 ----------------- src/rt/shell/fs/tree.ts | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 17 deletions(-) create mode 100644 src/rt/shell/fs/tree.ts diff --git a/src/rt/shell/fs/core.ts b/src/rt/shell/fs/core.ts index f00a7a1..0167bff 100644 --- a/src/rt/shell/fs/core.ts +++ b/src/rt/shell/fs/core.ts @@ -11,22 +11,6 @@ const enum Permissions { type FsEntry = Entry<{}> type FsDirectory = Entry -const user = [ - Entry("about_me.txt", "about me inside", Permissions.rw), - Entry("services.txt", "services inside", Permissions.rw), - Entry("hi", [], Permissions.rw) -] -const home = [ - Entry("user", user, Permissions.rw) -] -const root = [ - Entry("home", home, Permissions.r), - Entry("bin", {}, Permissions.r), -] -const fs = [ - Entry("/", root, Permissions.r) -] - type File = string interface Entry { readonly inner?: T, @@ -44,7 +28,6 @@ function Entry(name: string, inner: T, permissions: Permissions): Entr } export { - fs, type FsDirectory, type FsEntry, EntryType, diff --git a/src/rt/shell/fs/tree.ts b/src/rt/shell/fs/tree.ts new file mode 100644 index 0000000..71183c7 --- /dev/null +++ b/src/rt/shell/fs/tree.ts @@ -0,0 +1,19 @@ +import { Entry, Permissions } from "./core" + +const user = [ + Entry("about_me.txt", "about me inside", Permissions.rw), + Entry("services.txt", "services inside", Permissions.rw), + Entry("hi", [], Permissions.rw) +] +const home = [ + Entry("user", user, Permissions.rw) +] +const root = [ + Entry("home", home, Permissions.r), + Entry("bin", {}, Permissions.r), +] +const fstree = [ + Entry("/", root, Permissions.r) +] + +export default fstree \ No newline at end of file