Skip to main content

resolve_vfs_path

Function resolve_vfs_path 

Source
pub fn resolve_vfs_path(vfs: &Vfs, path: &str) -> Option<String>
Expand description

Applies a text-based patch to a Virtual File System (VFS) and returns the new VFS.

This is the primary public API for the zenpatch crate. It handles patch parsing and application for multiple file operations within a single patch.

§Arguments

  • patch_text - A string slice containing the patch in the expected format.
  • vfs - A reference to the initial Virtual File System.

§Returns

  • Ok(Vfs) - The patched VFS on success.
  • Err(ZenpatchError) - An error if parsing or application fails. Resolve a patch’s target path against the VFS. Returns the exact key when it exists; otherwise, if the model dropped a leading path prefix (e.g. wrote crates/x.rs for a VFS key a/b/crates/x.rs), returns the UNIQUE key whose path ends with the given path at a path boundary. Zero or multiple (ambiguous) suffix matches resolve to None, so a genuine miss stays a miss.