Skip to main content

VtCodePaths

Struct VtCodePaths 

Source
pub struct VtCodePaths { /* private fields */ }
Expand description

Validated native/XDG storage roots and typed VT Code child paths.

Implementations§

Source§

impl VtCodePaths

Source

pub fn from_env() -> Result<Self>

Resolves paths from the process environment.

Source

pub fn resolve() -> Result<Self>

Alias for Self::from_env, useful during startup resolution.

Source

pub fn from_environment(environment: &[(&str, &str)]) -> Result<Self>

Resolves paths from an explicit environment, suitable for deterministic tests.

Source

pub fn config_dir(&self) -> &Path

Canonical directory for user configuration.

Source

pub fn data_dir(&self) -> &Path

Canonical directory for durable user data.

Source

pub fn state_dir(&self) -> &Path

Canonical directory for durable mutable state.

Source

pub fn cache_dir(&self) -> &Path

Canonical directory for recreatable cached data.

Source

pub fn runtime_dir(&self) -> &Path

Private directory for runtime-only files.

Source

pub fn executable_dir(&self) -> &Path

User executable helper directory.

Source

pub fn system_config_dirs(&self) -> &[PathBuf]

System configuration candidates, lowest priority first.

Source

pub fn system_data_dirs(&self) -> &[PathBuf]

System data candidates without an application suffix.

Source

pub fn system_config_paths( &self, relative: impl AsRef<Path>, ) -> Result<Vec<PathBuf>>

Resolves a relative config path against all system candidates in low-to-high precedence order. system_config_dirs() retains the XDG preference order, where the first directory is most important.

Source

pub fn system_data_paths( &self, relative: impl AsRef<Path>, ) -> Result<Vec<PathBuf>>

Resolves a relative data path against all system candidates.

Source

pub fn legacy_home_dir(&self) -> &Path

Legacy global VT Code root, used only as a migration source.

Source

pub fn legacy_dir(&self) -> &Path

Alias for Self::legacy_home_dir using the public contract name.

Source

pub fn config_path(&self, relative: impl AsRef<Path>) -> Result<PathBuf>

Resolve a relative child path under the canonical configuration root.

Source

pub fn data_path(&self, relative: impl AsRef<Path>) -> Result<PathBuf>

Resolve a relative child path under the canonical data root.

Source

pub fn state_path(&self, relative: impl AsRef<Path>) -> Result<PathBuf>

Resolve a relative child path under the persistent state root.

Source

pub fn cache_path(&self, relative: impl AsRef<Path>) -> Result<PathBuf>

Resolve a relative child path under the cache root.

Source

pub fn runtime_path(&self, relative: impl AsRef<Path>) -> Result<PathBuf>

Resolve a relative child path under the runtime root.

Source

pub fn executable_path(&self, relative: impl AsRef<Path>) -> Result<PathBuf>

Resolve a relative child path under the managed executable root.

Source

pub fn config_file(&self) -> PathBuf

Main user configuration file.

Source

pub fn skills_dir(&self) -> PathBuf

User-installed and downloaded skills.

Source

pub fn plugins_dir(&self) -> PathBuf

User-installed plugins.

Source

pub fn auth_dir(&self) -> PathBuf

Private authentication storage.

Source

pub fn auth_file(&self) -> PathBuf

Legacy plaintext authentication file location.

Source

pub fn logs_dir(&self) -> PathBuf

Durable log files.

Source

pub fn sessions_dir(&self) -> PathBuf

Persisted cross-workspace session data.

Source

pub fn telemetry_dir(&self) -> PathBuf

Telemetry storage.

Source

pub fn migration_marker_path(&self) -> PathBuf

Completion marker for one-time legacy migration.

Source

pub fn migration_report_path(&self) -> PathBuf

Versioned diagnostic report emitted alongside the completion marker.

Source

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

Creates the runtime directory with private permissions.

Source

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

Creates the canonical user configuration directory when needed. Existing directories retain their permissions.

Source

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

Creates the canonical user data directory when needed. Existing directories retain their permissions.

Source

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

Creates the canonical user state directory when needed. Existing directories retain their permissions.

Source

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

Creates the canonical user cache directory when needed. Existing directories retain their permissions.

Source

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

Creates the managed executable directory when needed. Existing directories retain their permissions.

Source

pub fn ensure_user_dir(path: impl AsRef<Path>) -> Result<PathBuf>

Creates an arbitrary user-owned directory without following symlinks. Existing directories retain their permissions; newly created Unix directories use mode 0700.

Source

pub fn create_private_file(path: impl AsRef<Path>) -> Result<File>

Creates a new private file without following a final symlink.

The parent is validated component by component before the file is opened. This is the common primitive for caches, locks, and other category-owned files that must never be redirected through a symlink.

Source

pub fn open_private_append_file(path: impl AsRef<Path>) -> Result<File>

Opens an append-only private file without following a final symlink.

Source

pub fn read_file_no_follow(path: impl AsRef<Path>) -> Result<Vec<u8>>

Reads a regular file without following a final symlink.

Source

pub fn write_private_file_atomic( path: impl AsRef<Path>, contents: &[u8], ) -> Result<()>

Atomically writes a private file, replacing an existing regular file.

The destination is never opened for writing. A private, exclusive temporary file is written and then renamed into place, so a pre-existing symlink cannot redirect the contents outside the approved parent.

Source

pub fn ensure_runtime_child_dir( &self, relative: impl AsRef<Path>, ) -> Result<PathBuf>

Creates a private runtime child directory after validating its path.

Source

pub fn ensure_config_child_dir( &self, relative: impl AsRef<Path>, ) -> Result<PathBuf>

Creates a user configuration child directory after validating its path.

Source

pub fn ensure_data_child_dir( &self, relative: impl AsRef<Path>, ) -> Result<PathBuf>

Creates a user data child directory after validating its path.

Source

pub fn ensure_state_child_dir( &self, relative: impl AsRef<Path>, ) -> Result<PathBuf>

Creates a user state child directory after validating its path.

Source

pub fn ensure_cache_child_dir( &self, relative: impl AsRef<Path>, ) -> Result<PathBuf>

Creates a user cache child directory after validating its path.

Source

pub fn ensure_executable_child_dir( &self, relative: impl AsRef<Path>, ) -> Result<PathBuf>

Creates a managed executable child directory after validating its path.

Source

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

Creates private auth storage and returns its path.

Source

pub fn create_auth_file(&self, name: impl AsRef<str>) -> Result<PathBuf>

Creates an empty, private auth file. The name must not contain a path.

Source

pub fn migrate_legacy(&self) -> Result<MigrationReport>

Copies eligible legacy global data without modifying its source.

Trait Implementations§

Source§

impl Clone for VtCodePaths

Source§

fn clone(&self) -> VtCodePaths

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for VtCodePaths

Source§

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

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

impl Eq for VtCodePaths

Source§

impl PartialEq for VtCodePaths

Source§

fn eq(&self, other: &VtCodePaths) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for VtCodePaths

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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 = !

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more