os: the six user folders and the user-dirs.dirs reading (step 1 of #130, OS slice 6) #531
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Slice 6 of
docs/design/OS.md, first step (epic #130):std/osanswers the six user foldersDirectories.documents(),downloads(),desktop(),pictures(),music()andvideos()on Windows, Linux, macOS and FreeBSD, with theuser-dirs.dirsreading of the XDG half in TorbScript. The browser answersOsError.Unsupported, like the base directories do.Specification
documentsand the rest") and the slice 6 row of section 10. docs/ROADMAP.md listsstd/os"the rest of their slices" (#126 to #131); this is a step of #130.xdg/,Windows.knownFolder), done. #126 (slice 2) is closed.Acceptance criteria
Directoriesgainsdocuments(),downloads(),desktop(),pictures(),music()andvideos(), eachstatic fn ...(): Result<Path, OsError>with a doc comment, as in OS.md 5.8, each amatch OperatingSystem.currentlike the base six.xdg/directories.trb): readuser-dirs.dirsin the configuration directory ($XDG_CONFIG_HOME, else~/.config) and takeXDG_DOCUMENTS_DIR,XDG_DOWNLOAD_DIR,XDG_DESKTOP_DIR,XDG_PICTURES_DIR,XDG_MUSIC_DIRandXDG_VIDEOS_DIR; a missing file, a missing key, or a value that is not an absolute path after$HOMEexpansion falls back to~/Documents,~/Downloads,~/Desktop,~/Pictures,~/Music,~/Videos. The file is read with the existing file helper ofstd/os(no new native).user-dirs.dirsis public and pure (text,home, key in;Path?out), so its tests run on every machine with captured text. They cover: the usual file withXDG_DOCUMENTS_DIR="$HOME/Documents"lines; comment and blank lines skipped; a quoted absolute path without$HOME; a value renamed by the user ("$HOME/Dokumente"); a key set to"$HOME/"(the XDG way to say "this folder does not exist": falls back, not the home directory itself); a relative value ignored; an unterminated quote ignored; a line for another key not mistaken for the asked one (XDG_DOCUMENTS_DIR_EXTRA).windows/directories.trb):Windows.knownFolderwith the Known Folder idsFOLDERID_Documents,FOLDERID_Downloads,FOLDERID_Desktop,FOLDERID_Pictures,FOLDERID_Music,FOLDERID_Videos, the same wayhomeis answered. No new native.macos/directories.trb):~/Documents,~/Downloads,~/Desktop,~/Pictures,~/Music,~/Movies(the Finder's name for videos), joined tohome().OsError.Unsupportedthroughbrowser.unsupported, naming the question.std/os/tests/host.test.trbstyle: each of the six answers an absolute path on the host (every system but the browser has a fallback, so none may fail wherehome()works).torb check --every-targetis clean;docs/standard-library/os.mddocuments the six with the table row of 5.8 and an example;docs checkis clean andskills/regenerated. OS.md slice 6 gets a note "Step 1 done (date)" in the slice table, like slice 3 has; the row is marked done when the epic is.Seed impact
No. No syntax change, no new native (the Known Folder native and the file helper exist), no std name the compiler looks up by string. The compiler does not call these functions.
Size
One PR, two Conventional Commits:
feat(os): the user folders on Linux and FreeBSD, with the user-dirs.dirs parser(parser, XDG half, tests)feat(os): Directories.documents and the other five user folders on every system(theDirectoriessurface, Windows, macOS and browser arms, host test, docs, OS.md note)Only
std/os, its tests,docs/standard-library/os.md,docs/design/OS.mdandskills/change; no C.Part of #130 (epic).
[loop:torbscript] claim implement by session:loop-torbscript-20261027 until 2026-10-27T09:55Z
[loop:torbscript] implement: checkpoint. Branch
loop/531-user-folderspushed (2 commits): xdg half with public pureparseUserDirectory, Windows/macOS arms, the sixDirectoriesfunctions, parser and host tests;torb check std/osclean locally. Decided by the loop: the issue's "existing file helper of std/os" does not exist for this file (Linux.readSystemFileonly reads /proc, /sys and os-release, by design), so the XDG half readsuser-dirs.dirswithFile.readTextofstd/fs(no new native, no cycle: std/fs does not import std/os). Open: browser arms are covered bybrowser.unsupportedinDirectories; still to do: docs/standard-library/os.md (table row + example), OS.md slice 6 note "Step 1 done (2026-10-27)",torb docscheck +skills/regen, open PRCloses #531, read CI with ci-wait.sh. next: docs and PR.[loop:torbscript] claim implement (continuation 1 of 3, pinned on anthropic:notahumanmate) by session:loop-torbscript-20261027 until 2026-10-27T10:10Z
[loop:torbscript] implement: checkpoint. PR #532 open (
Closes #531). Tier A of78fa79d8was red only ondocs declarations --checkanddocs skill --check(declaration order ofDirectories, stale skill copy); fixed in1d84edf2, CI running. Everything else of the gates (std/os check, tests native and VM, docs check) was green. next: read CI of1d84edf2with ci-wait.sh.[loop:torbscript] release implement: the stale claim of continuation 1 expired; PR #532 (head
1d84edf2) carries all work and forge CI is queued. next: waiting (CI on PR #532); red tier A gets a fix worker from the PR state.[loop:torbscript] implement: continuation 1 ended (worker run hit its time limit while waiting on CI, no further code change after the 07:28 checkpoint). PR #532 head
1d84edf2: bootstrap (linux-x64) green, tier A still running. Claim released. next: waiting (CI on PR #532); on red tier A a fix round.[loop:torbscript] post-merge: PR #532 merged (argus approved at
5b49bc6, merge commit77259d30). No After-merge steps and no deploy for torbscript/language; the change lands on main with the merge. Task closed with this evidence.