Allow opening of non-existant files, fixes #434

This commit is contained in:
Jeremy Soller 2025-10-14 09:58:44 -06:00
parent d795b1fca4
commit bce1d2aebc
No known key found for this signature in database
GPG key ID: 670FDFB5428E05CA
3 changed files with 130 additions and 146 deletions

View file

@ -31,7 +31,7 @@ use std::{
any::TypeId,
collections::HashMap,
env, fs, io,
path::{Path, PathBuf},
path::{self, Path, PathBuf},
process,
sync::{Mutex, OnceLock},
};
@ -648,10 +648,13 @@ impl App {
Some(path) => {
let canonical = match fs::canonicalize(&path) {
Ok(ok) => ok,
Err(err) => {
log::error!("failed to canonicalize {:?}: {}", path, err);
return None;
}
Err(err) => match path::absolute(&path) {
Ok(ok) => ok,
Err(_) => {
log::error!("failed to canonicalize {:?}: {}", path, err);
return None;
}
},
};
//TODO: allow files to be open multiple times