app-server: preserve legacy cwd strings in exec events

This commit is contained in:
Adam Perry
2026-06-23 01:35:47 +00:00
parent 67009bc53f
commit 1544a003db
10 changed files with 90 additions and 31 deletions
@@ -81,9 +81,11 @@ impl LegacyAppPathString {
})
}
/// Parses this API string as an absolute path using the convention inferred from its spelling.
/// Parses this API string as a file URI or as an absolute path using its inferred convention.
pub fn to_inferred_path_uri(&self) -> Option<PathUri> {
PathUri::try_from(self.clone()).ok()
PathUri::parse(&self.0)
.ok()
.or_else(|| PathUri::try_from(self.clone()).ok())
}
/// Parses this API string as a host-native absolute path.
@@ -465,6 +465,24 @@ fn converts_absolute_api_paths_using_the_inferred_convention() {
}
}
#[test]
fn converts_raw_file_uris_to_inferred_path_uris() {
for raw_uri in [
"file:///workspace/file.rs",
"file:///C:/workspace/file.rs",
"file://server/share/file.rs",
] {
let path = serde_json::from_value::<LegacyAppPathString>(serde_json::json!(raw_uri))
.expect("raw file URI should deserialize as API text");
assert_eq!(
path.to_inferred_path_uri(),
Some(PathUri::parse(raw_uri).expect("raw file URI should parse")),
"round-tripping {raw_uri:?}",
);
}
}
#[test]
fn converts_native_api_path_to_inferred_absolute_path() {
#[cfg(windows)]