MCPcopy Create free account
hub / github.com/AI45Lab/Code / normalize_virtual_path

Function normalize_virtual_path

core/src/workspace/mod.rs:895–909  ·  view source on GitHub ↗
(input: &str)

Source from the content-addressed store, hash-verified

893}
894
895fn normalize_virtual_path(input: &str) -> Result<WorkspacePath> {
896 let input = default_path_input(input);
897 if has_windows_path_prefix(input) {
898 bail!("Absolute paths are not supported by this workspace backend");
899 }
900
901 let normalized_input = input.replace('\\', "/");
902 let path = Path::new(&normalized_input);
903 if path.is_absolute() {
904 bail!("Absolute paths are not supported by this workspace backend");
905 }
906
907 let relative = normalize_relative_path(path)?;
908 Ok(pathbuf_to_workspace_path(&relative))
909}
910
911fn default_path_input(input: &str) -> &str {
912 let trimmed = input.trim();

Callers 1

normalizeMethod · 0.85

Calls 4

default_path_inputFunction · 0.85
has_windows_path_prefixFunction · 0.85
normalize_relative_pathFunction · 0.85

Tested by

no test coverage detected