diff --git a/crates/pi-builtins/src/ls.rs b/crates/pi-builtins/src/ls.rs index 71d6f2054..09e220c79 100644 --- a/crates/pi-builtins/src/ls.rs +++ b/crates/pi-builtins/src/ls.rs @@ -3736,7 +3736,8 @@ struct LsRuntime { impl LsRuntime { fn resolve(&self, path: impl AsRef) -> PathBuf { - let path = path.as_ref(); + let normalized_path = brush_core::sys::fs::normalize_shell_path(path.as_ref()); + let path = normalized_path.as_ref(); if path.is_absolute() { path.to_path_buf() } else { self.cwd.join(path) } } @@ -5238,6 +5239,23 @@ mod integration_tests { assert_eq!(capture.out(), "visible-name\n"); } + #[cfg(windows)] + #[test] + fn resolves_msys_drive_alias_operands() { + let dir = tempfile::tempdir().unwrap(); + File::create(dir.path().join("visible-name")).unwrap(); + let native = dir.path().to_string_lossy().replace('\\', "/"); + let (drive, tail) = native + .split_once(":/") + .unwrap_or_else(|| panic!("expected drive-qualified temp path, got {native:?}")); + let alias = format!("/{}/{}", drive.to_ascii_lowercase(), tail); + + let (code, capture) = run_util::(&[&alias], "", dir.path()); + + assert_eq!(code, 0); + assert_eq!(capture.out(), "visible-name\n"); + } + #[test] fn reads_quoting_style_from_the_shell_environment() { let dir = tempfile::tempdir().unwrap();