Skip to content

Customising the Filesystem

Retro-Jack edited this page May 8, 2026 · 20 revisions

Customising the Filesystem

The virtual filesystem lives in prompt/javascript/fs.js as a JS array called fs. Every directory and every file is an object in that tree. No server, no database — edit the file, hard-refresh, you're done.

Where to look

var fs = [{
  name: 'C',
  directories: [ ... ],
  files: [ ... ]
}];

A node is one of:

Shape Means
{ name, directories, files } a directory
{ name, link } a "file" that opens a URL when executed
{ name, data } a "file" whose data is run as a batch script when executed

hidden: true on a node hides it from dir (still navigable via cd).


Add a link file

{ name: 'GITHUB.COM', link: 'https://github.com/yourname' }

Drop it into any directory's files array. The user can cd into the directory and type github.com to open it.


Add a batch file

{ name: 'HELLO.BAT',
  data: 'echo off\nsetcol 2e\necho Hello, world!\nsetcol 07\necho on' }

Lines are separated by \n. Supported batch commands: anything in Commands plus any filename present in the current directory.


Add a directory

{ name: 'MUSIC',
  directories: [],
  files: [
    { name: 'BANDCAMP.COM', link: 'https://yourname.bandcamp.com' }
  ]
}

Add a system menu (numbered list)

The standard pattern for a system with several titles: a directory whose menu.bat prints a CP437 box, plus numbered launcher .bat files that each run a named link .bat.

{ name: 'GAMES', directories: [], files: [
    { name: 'menu.bat', data: 'echo off\ncls\necho ÉÍÍÍ...»\n...echo on\n' },
    { name: '0.bat',    data: 'echo off\ncd ..\ncd ..\nmenu\n' },
    { name: '1.bat',    data: 'sonic1\n' },
    { name: '2.bat',    data: 'sonic2\n' },
    { name: 'sonic1.bat', link: '../emulators/genesis/play.html?game=sonic1' },
    { name: 'sonic2.bat', link: '../emulators/genesis/play.html?game=sonic2' },
] }

The user types a number → it runs the matching N.bat → which runs <key> → which resolves to <key>.bat (the link: entry) → which opens the emulator URL.

For a real example see the GENESIS or NES blocks in fs.js.


Menu box format

Standard menus use double-rule CP437 borders with a 45-char inner width.

ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»     top
º              CENTERED HEADER               º     header (45 chars)
ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ     separator
º   1.  CMDNAME   Title                      º     entry
º   0.  Back                                  º     back
ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ     bottom

Entry row layout (45 chars between º):

Segment Width
Number prefix N. / NN. 7
Code name padded typically 8
Title padded to fill the rest

Notes:

  • Apostrophes in titles must be escaped: K.C.\'s Krazy Chase! inside a '...' string.
  • Single rule (Ú¿À┘─│┬┴) and double rule (ɻȼ═║) are both available — see CP437.

Boot

autoexec.bat runs automatically on load. The default is c:\ncls\nmenu\n — change directory to root, clear screen, render the root menu (which is c:\menu.bat).

To boot to a different starting place:

{ name: 'autoexec.bat', data: 'c:\ncd emulators\\dos\ncls\ndir/w/o\n' }

To set colours at boot, prepend setcol:

{ name: 'autoexec.bat', data: 'echo off\nsetcol 02\nc:\ncls\nmenu\n' }

Common combos:

Code bg / fg
07 black / light grey (default)
0f black / white
17 dark blue / light grey
02 black / dark green
0a black / green
0e black / yellow

See Font System for the 16-colour palette.


Tips

  • Use absolute paths (cd\\games\\action) inside .bat files; relative cd only works if the target is a direct child.
  • Files can only be executed from the directory they live in — there is no PATH.
  • For menu generation it's much easier to write a small Python helper that emits the echo lines than to hand-craft the box-drawing characters.

Clone this wiki locally