pub struct VtCodePaths { /* private fields */ }Expand description
Validated native/XDG storage roots and typed VT Code child paths.
Implementations§
Source§impl VtCodePaths
impl VtCodePaths
Sourcepub fn resolve() -> Result<Self>
pub fn resolve() -> Result<Self>
Alias for Self::from_env, useful during startup resolution.
Sourcepub fn from_environment(environment: &[(&str, &str)]) -> Result<Self>
pub fn from_environment(environment: &[(&str, &str)]) -> Result<Self>
Resolves paths from an explicit environment, suitable for deterministic tests.
Sourcepub fn config_dir(&self) -> &Path
pub fn config_dir(&self) -> &Path
Canonical directory for user configuration.
Sourcepub fn runtime_dir(&self) -> &Path
pub fn runtime_dir(&self) -> &Path
Private directory for runtime-only files.
Sourcepub fn executable_dir(&self) -> &Path
pub fn executable_dir(&self) -> &Path
User executable helper directory.
Sourcepub fn system_config_dirs(&self) -> &[PathBuf]
pub fn system_config_dirs(&self) -> &[PathBuf]
System configuration candidates, lowest priority first.
Sourcepub fn system_data_dirs(&self) -> &[PathBuf]
pub fn system_data_dirs(&self) -> &[PathBuf]
System data candidates without an application suffix.
Sourcepub fn system_config_paths(
&self,
relative: impl AsRef<Path>,
) -> Result<Vec<PathBuf>>
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.
Sourcepub fn system_data_paths(
&self,
relative: impl AsRef<Path>,
) -> Result<Vec<PathBuf>>
pub fn system_data_paths( &self, relative: impl AsRef<Path>, ) -> Result<Vec<PathBuf>>
Resolves a relative data path against all system candidates.
Sourcepub fn legacy_home_dir(&self) -> &Path
pub fn legacy_home_dir(&self) -> &Path
Legacy global VT Code root, used only as a migration source.
Sourcepub fn legacy_dir(&self) -> &Path
pub fn legacy_dir(&self) -> &Path
Alias for Self::legacy_home_dir using the public contract name.
Sourcepub fn config_path(&self, relative: impl AsRef<Path>) -> Result<PathBuf>
pub fn config_path(&self, relative: impl AsRef<Path>) -> Result<PathBuf>
Resolve a relative child path under the canonical configuration root.
Sourcepub fn data_path(&self, relative: impl AsRef<Path>) -> Result<PathBuf>
pub fn data_path(&self, relative: impl AsRef<Path>) -> Result<PathBuf>
Resolve a relative child path under the canonical data root.
Sourcepub fn state_path(&self, relative: impl AsRef<Path>) -> Result<PathBuf>
pub fn state_path(&self, relative: impl AsRef<Path>) -> Result<PathBuf>
Resolve a relative child path under the persistent state root.
Sourcepub fn cache_path(&self, relative: impl AsRef<Path>) -> Result<PathBuf>
pub fn cache_path(&self, relative: impl AsRef<Path>) -> Result<PathBuf>
Resolve a relative child path under the cache root.
Sourcepub fn runtime_path(&self, relative: impl AsRef<Path>) -> Result<PathBuf>
pub fn runtime_path(&self, relative: impl AsRef<Path>) -> Result<PathBuf>
Resolve a relative child path under the runtime root.
Sourcepub fn executable_path(&self, relative: impl AsRef<Path>) -> Result<PathBuf>
pub fn executable_path(&self, relative: impl AsRef<Path>) -> Result<PathBuf>
Resolve a relative child path under the managed executable root.
Sourcepub fn config_file(&self) -> PathBuf
pub fn config_file(&self) -> PathBuf
Main user configuration file.
Sourcepub fn skills_dir(&self) -> PathBuf
pub fn skills_dir(&self) -> PathBuf
User-installed and downloaded skills.
Sourcepub fn plugins_dir(&self) -> PathBuf
pub fn plugins_dir(&self) -> PathBuf
User-installed plugins.
Sourcepub fn sessions_dir(&self) -> PathBuf
pub fn sessions_dir(&self) -> PathBuf
Persisted cross-workspace session data.
Sourcepub fn telemetry_dir(&self) -> PathBuf
pub fn telemetry_dir(&self) -> PathBuf
Telemetry storage.
Sourcepub fn migration_marker_path(&self) -> PathBuf
pub fn migration_marker_path(&self) -> PathBuf
Completion marker for one-time legacy migration.
Sourcepub fn migration_report_path(&self) -> PathBuf
pub fn migration_report_path(&self) -> PathBuf
Versioned diagnostic report emitted alongside the completion marker.
Sourcepub fn ensure_runtime_dir(&self) -> Result<&Path>
pub fn ensure_runtime_dir(&self) -> Result<&Path>
Creates the runtime directory with private permissions.
Sourcepub fn ensure_config_dir(&self) -> Result<&Path>
pub fn ensure_config_dir(&self) -> Result<&Path>
Creates the canonical user configuration directory when needed. Existing directories retain their permissions.
Sourcepub fn ensure_data_dir(&self) -> Result<&Path>
pub fn ensure_data_dir(&self) -> Result<&Path>
Creates the canonical user data directory when needed. Existing directories retain their permissions.
Sourcepub fn ensure_state_dir(&self) -> Result<&Path>
pub fn ensure_state_dir(&self) -> Result<&Path>
Creates the canonical user state directory when needed. Existing directories retain their permissions.
Sourcepub fn ensure_cache_dir(&self) -> Result<&Path>
pub fn ensure_cache_dir(&self) -> Result<&Path>
Creates the canonical user cache directory when needed. Existing directories retain their permissions.
Sourcepub fn ensure_executable_dir(&self) -> Result<&Path>
pub fn ensure_executable_dir(&self) -> Result<&Path>
Creates the managed executable directory when needed. Existing directories retain their permissions.
Sourcepub fn ensure_user_dir(path: impl AsRef<Path>) -> Result<PathBuf>
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.
Sourcepub fn create_private_file(path: impl AsRef<Path>) -> Result<File>
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.
Sourcepub fn open_private_append_file(path: impl AsRef<Path>) -> Result<File>
pub fn open_private_append_file(path: impl AsRef<Path>) -> Result<File>
Opens an append-only private file without following a final symlink.
Sourcepub fn read_file_no_follow(path: impl AsRef<Path>) -> Result<Vec<u8>>
pub fn read_file_no_follow(path: impl AsRef<Path>) -> Result<Vec<u8>>
Reads a regular file without following a final symlink.
Sourcepub fn write_private_file_atomic(
path: impl AsRef<Path>,
contents: &[u8],
) -> Result<()>
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.
Sourcepub fn ensure_runtime_child_dir(
&self,
relative: impl AsRef<Path>,
) -> Result<PathBuf>
pub fn ensure_runtime_child_dir( &self, relative: impl AsRef<Path>, ) -> Result<PathBuf>
Creates a private runtime child directory after validating its path.
Sourcepub fn ensure_config_child_dir(
&self,
relative: impl AsRef<Path>,
) -> Result<PathBuf>
pub fn ensure_config_child_dir( &self, relative: impl AsRef<Path>, ) -> Result<PathBuf>
Creates a user configuration child directory after validating its path.
Sourcepub fn ensure_data_child_dir(
&self,
relative: impl AsRef<Path>,
) -> Result<PathBuf>
pub fn ensure_data_child_dir( &self, relative: impl AsRef<Path>, ) -> Result<PathBuf>
Creates a user data child directory after validating its path.
Sourcepub fn ensure_state_child_dir(
&self,
relative: impl AsRef<Path>,
) -> Result<PathBuf>
pub fn ensure_state_child_dir( &self, relative: impl AsRef<Path>, ) -> Result<PathBuf>
Creates a user state child directory after validating its path.
Sourcepub fn ensure_cache_child_dir(
&self,
relative: impl AsRef<Path>,
) -> Result<PathBuf>
pub fn ensure_cache_child_dir( &self, relative: impl AsRef<Path>, ) -> Result<PathBuf>
Creates a user cache child directory after validating its path.
Sourcepub fn ensure_executable_child_dir(
&self,
relative: impl AsRef<Path>,
) -> Result<PathBuf>
pub fn ensure_executable_child_dir( &self, relative: impl AsRef<Path>, ) -> Result<PathBuf>
Creates a managed executable child directory after validating its path.
Sourcepub fn ensure_auth_dir(&self) -> Result<PathBuf>
pub fn ensure_auth_dir(&self) -> Result<PathBuf>
Creates private auth storage and returns its path.
Sourcepub fn create_auth_file(&self, name: impl AsRef<str>) -> Result<PathBuf>
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.
Sourcepub fn migrate_legacy(&self) -> Result<MigrationReport>
pub fn migrate_legacy(&self) -> Result<MigrationReport>
Copies eligible legacy global data without modifying its source.
Trait Implementations§
Source§impl Clone for VtCodePaths
impl Clone for VtCodePaths
Source§fn clone(&self) -> VtCodePaths
fn clone(&self) -> VtCodePaths
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VtCodePaths
impl Debug for VtCodePaths
impl Eq for VtCodePaths
Source§impl PartialEq for VtCodePaths
impl PartialEq for VtCodePaths
impl StructuralPartialEq for VtCodePaths
Auto Trait Implementations§
impl Freeze for VtCodePaths
impl RefUnwindSafe for VtCodePaths
impl Send for VtCodePaths
impl Sync for VtCodePaths
impl Unpin for VtCodePaths
impl UnsafeUnpin for VtCodePaths
impl UnwindSafe for VtCodePaths
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.