Fix windows path adjustment for mapped commands

feature/lookup-installed
trivernis 2 years ago
parent b938b44435
commit 190c4516e8
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -54,19 +54,15 @@ impl MappedCommand {
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
fn adjust_path(&mut self) -> CommandResult<()> { fn adjust_path(&mut self) -> CommandResult<()> {
if !self.path.exists() { let extensions = ["exe", "bat", "cmd", "ps1"];
let extensions = ["exe", "bat", "cmd", "ps1"]; for extension in &extensions {
for extension in &extensions { let joined_path = self.path.with_extension(extension);
let joined_path = self.path.with_extension(extension);
if joined_path.exists() { if joined_path.exists() {
self.path = joined_path; self.path = joined_path;
return Ok(()); return Ok(());
}
} }
return Err(CommandError::NotFound(self.path.to_owned()));
} }
Err(CommandError::NotFound(self.path.to_owned()))
Ok(())
} }
} }

Loading…
Cancel
Save