fix: Open editor on windows (#476)

This commit is contained in:
Solomon
2025-08-14 18:44:27 +01:00
committed by GitHub
parent 9b4ca9dc45
commit 605ac4a9ba
3 changed files with 25 additions and 1 deletions

View File

@@ -334,7 +334,23 @@ impl EditorConfig {
}
pub fn open_file(&self, path: &str) -> Result<(), std::io::Error> {
let command = self.get_command();
let mut command = self.get_command();
if command.is_empty() {
return Err(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
"No editor command configured",
));
}
if cfg!(windows) {
command[0] =
utils::shell::resolve_executable_path(&command[0]).ok_or(std::io::Error::new(
std::io::ErrorKind::NotFound,
format!("Editor command '{}' not found", command[0]),
))?;
}
let mut cmd = std::process::Command::new(&command[0]);
for arg in &command[1..] {
cmd.arg(arg);