pub struct PathResolver { /* private fields */ }Implementations§
Source§impl PathResolver
impl PathResolver
pub fn new() -> Self
pub fn with_home<P: Into<PathBuf>>(self, home: P) -> Self
pub fn with_gemini_dir<P: Into<PathBuf>>(self, gemini_dir: P) -> Self
pub fn home_dir(&self) -> Result<&Path>
pub fn gemini_dir(&self) -> Result<PathBuf>
pub fn projects_file(&self) -> Result<PathBuf>
pub fn tmp_dir(&self) -> Result<PathBuf>
Sourcepub fn project_dir(&self, project_path: &str) -> Result<PathBuf>
pub fn project_dir(&self, project_path: &str) -> Result<PathBuf>
Absolute path to the project slot directory under tmp/.
Looks up project_path in projects.json for its friendly name
first; if that directory doesn’t exist, falls back to
tmp/<sha256(project_path)>/. The returned path may not exist
yet — callers decide how to handle that.
pub fn chats_dir(&self, project_path: &str) -> Result<PathBuf>
pub fn session_dir( &self, project_path: &str, session_uuid: &str, ) -> Result<PathBuf>
pub fn chat_file( &self, project_path: &str, session_uuid: &str, chat_name: &str, ) -> Result<PathBuf>
pub fn logs_file(&self, project_path: &str) -> Result<PathBuf>
Sourcepub fn friendly_name_for(&self, project_path: &str) -> Result<Option<String>>
pub fn friendly_name_for(&self, project_path: &str) -> Result<Option<String>>
Read projects.json and reverse-lookup a friendly name for the
given absolute project path.
Sourcepub fn list_project_dirs(&self) -> Result<Vec<String>>
pub fn list_project_dirs(&self) -> Result<Vec<String>>
Return every project path known to Gemini: the union of
projects.json keys and any project slots present under tmp/
that have a .project_root marker.
Sourcepub fn list_sessions(&self, project_path: &str) -> Result<Vec<String>>
pub fn list_sessions(&self, project_path: &str) -> Result<Vec<String>>
List sessions under a project’s chats/ directory.
A session is either a top-level session-*.json main-chat file
(listed by its file stem) or an orphan <uuid>/ directory that
has no corresponding main file (listed by the dir name).
When both a session-*.json and a <uuid>/ dir point at the
same sessionId, the UUID dir is considered the main file’s
sub-agent bucket and is not surfaced as a separate session —
it gets merged into the main session by read_session.
Sourcepub fn list_main_session_stems(&self, project_path: &str) -> Result<Vec<String>>
pub fn list_main_session_stems(&self, project_path: &str) -> Result<Vec<String>>
List just the top-level main session file stems (no UUID dirs).
Sourcepub fn main_session_file(
&self,
project_path: &str,
stem: &str,
) -> Result<PathBuf>
pub fn main_session_file( &self, project_path: &str, stem: &str, ) -> Result<PathBuf>
Path to a main session JSON at the top of chats/.
Sourcepub fn resolve_main_file(
&self,
project_path: &str,
session_id: &str,
) -> Result<Option<PathBuf>>
pub fn resolve_main_file( &self, project_path: &str, session_id: &str, ) -> Result<Option<PathBuf>>
Locate a main chat file whose identity (either the filename stem
or the inner sessionId field) matches session_id.
This mirrors how Gemini CLI itself resolves --resume <id>: it
accepts both the on-disk stem (e.g. session-2026-04-17T18-09-b26d7f99)
and the full session UUID (which lives inside the file as
"sessionId"). Returns Ok(None) if nothing matches.
Does not consider UUID subdirectories — those are handled
separately in crate::ConvoIO::read_session as an orphan
sub-agent bucket.
Sourcepub fn list_chat_files(
&self,
project_path: &str,
session_uuid: &str,
) -> Result<Vec<String>>
pub fn list_chat_files( &self, project_path: &str, session_uuid: &str, ) -> Result<Vec<String>>
List chat file stems in a session directory (without .json).
pub fn exists(&self) -> bool
Trait Implementations§
Source§impl Clone for PathResolver
impl Clone for PathResolver
Source§fn clone(&self) -> PathResolver
fn clone(&self) -> PathResolver
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more