Skip to content

Commit

Permalink
allow to create new files
Browse files Browse the repository at this point in the history
  • Loading branch information
I60R committed Nov 22, 2022
1 parent 8828a08 commit 2d4b67b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/picker/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,16 @@ mod open_files {
pub fn new_existed_file<P: AsRef<Path> + std::fmt::Debug>(path: P) -> Option<FileToOpen> {
let path = match std::fs::canonicalize(&path) {
Ok(canonical) => canonical,
Err(_) => return None
Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
PathBuf::from(path.as_ref())
}
Err(e) => {
log::error!(
target: "open file",
"cannot open {path:?}: {e}"
);
return None;
}
};
let path_string = path
.to_string_lossy()
Expand Down

0 comments on commit 2d4b67b

Please sign in to comment.