use std::path::PathBuf;
use clipboard_win::{Clipboard, options::DoClear, raw};
const DROPEFFECT_COPY: u32 = 1;
pub fn set(paths: &[PathBuf]) -> Result<(), String> {
let failed = |e: clipboard_win::ErrorCode| format!("cannot put the files on the clipboard: {e}");
let _open = Clipboard::new_attempts(10).map_err(failed)?;
let paths: Vec<String> = paths.iter().map(|p| p.to_string_lossy().into_owned()).collect();
raw::set_file_list_with(&paths, DoClear).map_err(failed)?;
if let Some(format) = raw::register_format("Preferred DropEffect") {
raw::set_without_clear(format.get(), &DROPEFFECT_COPY.to_le_bytes()).map_err(failed)?;
}
Ok(())
}