mirror of https://github.com/helix-editor/helix
fix: delete path, not confirmation e.g. `y`
parent
6a558be7b3
commit
b6bbd4f18a
|
@ -508,14 +508,13 @@ pub fn file_explorer(root: PathBuf, editor: &Editor) -> Result<FileExplorer, std
|
||||||
cx,
|
cx,
|
||||||
path,
|
path,
|
||||||
|_| "".to_string(),
|
|_| "".to_string(),
|
||||||
|_, _, to_delete_str| {
|
|_, to_delete, confirmation| {
|
||||||
let to_delete = helix_stdx::path::expand_tilde(PathBuf::from(to_delete_str));
|
if confirmation == "y" {
|
||||||
if to_delete_str == "y" {
|
|
||||||
if !to_delete.exists() {
|
if !to_delete.exists() {
|
||||||
return Some(Err(format!("Path {} does not exist", to_delete.display())))
|
return Some(Err(format!("Path {} does not exist", to_delete.display())))
|
||||||
};
|
};
|
||||||
|
|
||||||
if to_delete_str.ends_with(std::path::MAIN_SEPARATOR) {
|
if confirmation.ends_with(std::path::MAIN_SEPARATOR) {
|
||||||
if let Err(err) = fs::remove_dir_all(&to_delete).map_err(
|
if let Err(err) = fs::remove_dir_all(&to_delete).map_err(
|
||||||
|err| format!(
|
|err| format!(
|
||||||
"Unable to delete directory {}: {err}", to_delete.display()
|
"Unable to delete directory {}: {err}", to_delete.display()
|
||||||
|
|
Loading…
Reference in New Issue