mirror of https://github.com/helix-editor/helix
fix: improve error message when path has no file name
parent
5e5766a123
commit
8414e01906
|
@ -2399,9 +2399,9 @@ fn move_buffer(cx: &mut compositor::Context, args: Args, event: PromptEvent) ->
|
||||||
let is_dir = new_path.is_dir();
|
let is_dir = new_path.is_dir();
|
||||||
|
|
||||||
let mut do_move = |old_path: PathBuf, editor: &mut Editor| {
|
let mut do_move = |old_path: PathBuf, editor: &mut Editor| {
|
||||||
let file_name = old_path
|
let Some(file_name) = old_path.file_name() else {
|
||||||
.file_name()
|
bail!("Cannot move this path: {}", old_path.to_string_lossy());
|
||||||
.context("Cannot move file: source is root directory")?;
|
};
|
||||||
// Allow moving files into directories without repeating the file name in the new path.
|
// Allow moving files into directories without repeating the file name in the new path.
|
||||||
if is_dir {
|
if is_dir {
|
||||||
new_path.push(file_name);
|
new_path.push(file_name);
|
||||||
|
|
Loading…
Reference in New Issue