Filesystem (src/fs.c)
The NoirOS filesystem is a lightweight tree structure with persistent snapshots.
Design
- Root directory plus nested subdirectories.
- Fixed-size arrays for files and directories (predictable memory use).
- File typing (
text,markdown,html,game,noirc,exe). - Optional persistence via ATA + FAT snapshot file.
Public API
Initialization and Context
init_filesystem()fs_root()fs_cwd()fs_pwd(out, out_len)
Directory Operations
fs_mkdir(name)fs_chdir(name)wherenamecan be directory name,.., or/fs_rmdir(name)(empty directory only)fs_dir_count()/fs_dir_get(idx)/fs_find_dir(name)
File Operations
fs_count()/fs_get(idx)/fs_find(name)fs_create(name, type)fs_delete(name)fs_write(name, data)fs_append(name, data)
Helpers
fs_list_counts(out_dirs, out_files)fs_type_from_name(name)
Error Codes
FS_OKFS_ERR_NOSPACEFS_ERR_EXISTSFS_ERR_NOTFOUNDFS_ERR_RDONLYFS_ERR_INVALIDFS_ERR_NOTDIRFS_ERR_DIRNOTEMPTY
Shell Mapping
mkdir->fs_mkdircd->fs_chdirrmdir->fs_rmdirtouch,new->fs_createrm,del->fs_deletecp,mv->fs_create+fs_write(+ delete formv)
Notes
- In-OS docs (
README.txt,readme.md,help.txt) are auto-refreshed at boot. - Game launcher files are auto-created under
/games.
Source: fs.c on GitHub