construct_full_relative_path

Function construct_full_relative_path 

Source
pub fn construct_full_relative_path(
    base_path: &Path,
    matched_path: &Path,
) -> String
Expand description

Constructs the full relative path for a matched pattern file.

Combines the base path with the matched file path, normalizing path separators for storage in the lockfile.

§Arguments

  • base_path - The base directory the pattern was resolved in
  • matched_path - The path to the matched file (relative to base_path)

§Returns

A normalized path string suitable for storage in the lockfile.

§Examples

use std::path::{Path, PathBuf};
use agpm_cli::resolver::path_resolver::construct_full_relative_path;

let base = PathBuf::from(".");
let matched = Path::new("agents/helper.md");
let path = construct_full_relative_path(&base, matched);
assert_eq!(path, "agents/helper.md");

let base = PathBuf::from("../foo");
let matched = Path::new("bar.md");
let path = construct_full_relative_path(&base, matched);
assert_eq!(path, "../foo/bar.md");