Cross-platform path helpers. A LEAF namespace (no project deps) so any layer — core, extensions, tests — can normalize without a require cycle.
Cross-platform path helpers. A LEAF namespace (no project deps) so any layer — core, extensions, tests — can normalize without a require cycle.
(abbreviate-home path)(abbreviate-home path home)Shorten an absolute path for DISPLAY by replacing the user's home dir with
~, matching the footer/navigator/dialogs. Only rewrites when path is at
or under home (so /etc/x and relative paths stay unchanged). Rendered
descendants always use / separators; nil-safe.
Shorten an absolute path for DISPLAY by replacing the user's home dir with `~`, matching the footer/navigator/dialogs. Only rewrites when `path` is at or under home (so `/etc/x` and relative paths stay unchanged). Rendered descendants always use `/` separators; nil-safe.
(ensure-logs-dir!)Create ~/.vis/logs (and parents) when absent; return its path string.
Never throws.
Create `~/.vis/logs` (and parents) when absent; return its path string. Never throws.
(expand-home path)(expand-home path home)Expand a leading ~ path segment to the user's home directory for filesystem
I/O. Bare ~ becomes home; ~/… and ~\… use native separators; ~user,
mid-path tildes, and ordinary paths pass through unchanged. Nil-safe and a
no-op when home is unavailable.
Expand a leading `~` path segment to the user's home directory for filesystem I/O. Bare `~` becomes home; `~/…` and `~\…` use native separators; `~user`, mid-path tildes, and ordinary paths pass through unchanged. Nil-safe and a no-op when home is unavailable.
(log-file)(log-file prefix)Diagnostic log file for THIS process — ~/.vis/logs/vis-<pid>.log, or
~/.vis/logs/<prefix>-<pid>.log for a second sink in the same process.
ONE WRITER PER FILE, by construction. Telemere's rolling file handler owns the file it writes and rotates by RENAMING it; with several vis processes (TUI, gateway daemon, CLI) on a single shared path, whichever one rotates pulls the file out from under the others, and they go on appending into a deleted inode — observed as a gateway writing 13.8 MB of stream traces into a file nobody could read. Stamping the pid into the name makes that impossible instead of merely unlikely.
Two sinks in the same process must NOT share one name either (a raw
FileOutputStream survives the rename with a stale fd), hence prefix —
GraalPy's polyglot log takes its own.
Growth is bounded by foundation.housekeeping/sweep-logs!, which prunes
~/.vis/logs by age; the rolling handler bounds each live file.
Diagnostic log file for THIS process — `~/.vis/logs/vis-<pid>.log`, or `~/.vis/logs/<prefix>-<pid>.log` for a second sink in the same process. ONE WRITER PER FILE, by construction. Telemere's rolling file handler owns the file it writes and rotates by RENAMING it; with several vis processes (TUI, gateway daemon, CLI) on a single shared path, whichever one rotates pulls the file out from under the others, and they go on appending into a deleted inode — observed as a gateway writing 13.8 MB of stream traces into a file nobody could read. Stamping the pid into the name makes that impossible instead of merely unlikely. Two sinks in the same process must NOT share one name either (a raw `FileOutputStream` survives the rename with a stale fd), hence `prefix` — GraalPy's polyglot log takes its own. Growth is bounded by `foundation.housekeeping/sweep-logs!`, which prunes `~/.vis/logs` by age; the rolling handler bounds each live file.
(logs-dir)Directory for vis diagnostic logs — ~/.vis/logs. A DEDICATED subdir (not
~/.vis itself) so the native file tools and the Python sandbox can be
granted always-on access to logs without exposing config.edn, the session
DB, or gateway tokens. Returns the path string (native separators are fine
for real I/O).
Directory for vis diagnostic logs — `~/.vis/logs`. A DEDICATED subdir (not `~/.vis` itself) so the native file tools and the Python sandbox can be granted always-on access to logs without exposing `config.edn`, the session DB, or gateway tokens. Returns the path string (native separators are fine for real I/O).
(process-id)This JVM's OS process id. Its only job is to make log-file unique per
process, so it is read fresh (never a load-time def): native-image
would otherwise bake the BUILDER's pid into the image.
This JVM's OS process id. Its only job is to make `log-file` unique per process, so it is read fresh (never a load-time `def`): `native-image` would otherwise bake the BUILDER's pid into the image.
(sandbox-defs-dir)Directory for persisted Python sandbox helper definitions — ~/.vis/sandbox.
Its own subdir (not ~/.vis) for the same reason as logs-dir: nothing here
needs to sit beside the session DB or the gateway token.
Directory for persisted Python sandbox helper definitions — `~/.vis/sandbox`. Its own subdir (not `~/.vis`) for the same reason as `logs-dir`: nothing here needs to sit beside the session DB or the gateway token.
(sandbox-defs-file session-id)File holding ONE session's persisted sandbox helper definitions —
~/.vis/sandbox/<session-id>.py. The sandbox dies with the process, so this
is what re-creates a session's own defs in a fresh one. The id is reduced
to a safe file name; every other character becomes _.
File holding ONE session's persisted sandbox helper definitions — `~/.vis/sandbox/<session-id>.py`. The sandbox dies with the process, so this is what re-creates a session's own `def`s in a fresh one. The id is reduced to a safe file name; every other character becomes `_`.
(unixify s)Normalize a path string to / separators on every OS. Java's File/Path
APIs can hand back platform-native separators — so this is the single
canonical normalizer.
Use it ONLY where a path is DATA: compared, glob-matched, shown to the model,
or embedded in a URL / wire / DB. NEVER for real filesystem I/O — io/file,
.exists, JGit, nio all take native paths fine. Returns nil for nil input.
Normalize a path string to `/` separators on every OS. Java's `File`/`Path` APIs can hand back platform-native separators — so this is the single canonical normalizer. Use it ONLY where a path is DATA: compared, glob-matched, shown to the model, or embedded in a URL / wire / DB. NEVER for real filesystem I/O — `io/file`, `.exists`, JGit, nio all take native paths fine. Returns nil for nil input.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |