Skip to main content

PathResolver

Struct PathResolver 

Source
pub struct PathResolver { /* private fields */ }

Implementations§

Source§

impl PathResolver

Source

pub fn new() -> Self

Source

pub fn with_home<P: Into<PathBuf>>(self, home: P) -> Self

Source

pub fn with_gemini_dir<P: Into<PathBuf>>(self, gemini_dir: P) -> Self

Source

pub fn home_dir(&self) -> Result<&Path>

Source

pub fn gemini_dir(&self) -> Result<PathBuf>

Source

pub fn projects_file(&self) -> Result<PathBuf>

Source

pub fn tmp_dir(&self) -> Result<PathBuf>

Source

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.

Source

pub fn chats_dir(&self, project_path: &str) -> Result<PathBuf>

Source

pub fn session_dir( &self, project_path: &str, session_uuid: &str, ) -> Result<PathBuf>

Source

pub fn chat_file( &self, project_path: &str, session_uuid: &str, chat_name: &str, ) -> Result<PathBuf>

Source

pub fn logs_file(&self, project_path: &str) -> Result<PathBuf>

Source

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.

Source

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.

Source

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.

Source

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).

Source

pub fn main_session_file( &self, project_path: &str, stem: &str, ) -> Result<PathBuf>

Path to a main session JSON at the top of chats/.

Source

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.

Source

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).

Source

pub fn exists(&self) -> bool

Trait Implementations§

Source§

impl Clone for PathResolver

Source§

fn clone(&self) -> PathResolver

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PathResolver

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PathResolver

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.