fix: use MAIN_SEPARATOR instead of just unix separator

pull/12902/head
Nikita Revenco 2025-02-18 15:02:38 +00:00
parent a9612dad1d
commit ed570d9f45
1 changed files with 4 additions and 4 deletions

View File

@ -33,9 +33,9 @@ pub use text::Text;
use helix_view::Editor; use helix_view::Editor;
use tui::text::Span; use tui::text::Span;
use std::fs;
use std::path::Path; use std::path::Path;
use std::{error::Error, path::PathBuf}; use std::{error::Error, path::PathBuf};
use std::{fs, path};
use self::picker::PickerKeyHandler; use self::picker::PickerKeyHandler;
@ -414,7 +414,7 @@ pub fn file_explorer(
}, },
)]; )];
let copy_path = |cx: &mut Context, (path, _is_dir): &(PathBuf, bool), _cursor: u32| { let yank_path = |cx: &mut Context, (path, _is_dir): &(PathBuf, bool), _cursor: u32| {
let register = cx let register = cx
.editor .editor
.selected_register .selected_register
@ -642,7 +642,7 @@ pub fn file_explorer(
.map(|p| p.to_path_buf()) .map(|p| p.to_path_buf())
.unwrap_or(helix_stdx::env::current_working_dir()); .unwrap_or(helix_stdx::env::current_working_dir());
if copy_from.is_dir() || copy_to_str.ends_with('/') { if copy_from.is_dir() || copy_to_str.ends_with(std::path::MAIN_SEPARATOR) {
// TODO: support copying directories (recursively)?. This isn't built-in to the standard library // TODO: support copying directories (recursively)?. This isn't built-in to the standard library
Some(Err(format!( Some(Err(format!(
"Copying directories is not supported: {} is a directory", "Copying directories is not supported: {} is a directory",
@ -697,7 +697,7 @@ pub fn file_explorer(
alt!('m') => Box::new(move_file) as KeyHandler, alt!('m') => Box::new(move_file) as KeyHandler,
alt!('d') => Box::new(delete_file) as KeyHandler, alt!('d') => Box::new(delete_file) as KeyHandler,
alt!('c') => Box::new(copy_file) as KeyHandler, alt!('c') => Box::new(copy_file) as KeyHandler,
alt!('y') => Box::new(copy_path) as KeyHandler, alt!('y') => Box::new(yank_path) as KeyHandler,
}); });
Ok(picker) Ok(picker)