Allow opening of non-existant files, fixes #434
This commit is contained in:
parent
d795b1fca4
commit
bce1d2aebc
3 changed files with 130 additions and 146 deletions
13
src/main.rs
13
src/main.rs
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue