feat: fix relative path executables

This commit is contained in:
iff 2024-12-09 16:10:08 +01:00
parent abed3be3ee
commit dee9cde334

View file

@ -5,6 +5,7 @@ use crate::{shell, suggestions};
use colored::Colorize; use colored::Colorize;
use inquire::*; use inquire::*;
use pay_respects_utils::evals::best_match_path; use pay_respects_utils::evals::best_match_path;
use pay_respects_utils::files::get_best_match_file;
use std::path::Path; use std::path::Path;
@ -66,7 +67,13 @@ pub fn cnf(data: &mut Data) {
executable executable
); );
let best_match = best_match_path(executable, &data.executables); let best_match = {
if executable.contains(std::path::MAIN_SEPARATOR) {
get_best_match_file(executable)
} else {
best_match_path(executable, &data.executables)
}
};
if best_match.is_some() { if best_match.is_some() {
let best_match = best_match.unwrap(); let best_match = best_match.unwrap();
split_command[0] = best_match; split_command[0] = best_match;
@ -151,4 +158,5 @@ pub fn cnf(data: &mut Data) {
suggestion(data); suggestion(data);
} }
} }
}
} }