Skip to main content

read_session_dir

Function read_session_dir 

Source
pub fn read_session_dir(args: &[String]) -> Option<PathBuf>
Expand description

Resolve the --session / --session-path / --session-name arguments to a session directory path that metrics.db would live under. Used by every read-side tool (nmbrs plot, nmbrs report, nmbrs metrics ..., completion) so the same flag means the same thing everywhere.

Returns None when no session flag is on the line — the caller falls back to its own default (typically logs/latest).

Never mutates the filesystem: no symlink rewrite, no purge. A pure path computation, because read-side tools must not have side effects on the active session symlink. This is now the ONLY way --session reaches a read command — the startup hook used to additionally repoint sessions/latest at the named session, which is exactly the side effect this doc warned against. See purge_stale_sessions_at_startup.