mirror of https://github.com/helix-editor/helix
Expand tildes in `:read` command (#12271)
parent
99fdbce566
commit
3b36cf1a15
|
@ -2507,7 +2507,8 @@ fn read(cx: &mut compositor::Context, args: &[Cow<str>], event: PromptEvent) ->
|
||||||
ensure!(args.len() == 1, "only the file name is expected");
|
ensure!(args.len() == 1, "only the file name is expected");
|
||||||
|
|
||||||
let filename = args.first().unwrap();
|
let filename = args.first().unwrap();
|
||||||
let path = PathBuf::from(filename.to_string());
|
let path = helix_stdx::path::expand_tilde(PathBuf::from(filename.to_string()));
|
||||||
|
|
||||||
ensure!(
|
ensure!(
|
||||||
path.exists() && path.is_file(),
|
path.exists() && path.is_file(),
|
||||||
"path is not a file: {:?}",
|
"path is not a file: {:?}",
|
||||||
|
|
Loading…
Reference in New Issue