fix: Open editor on windows (#476)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user