Move image check in the engine
This commit is contained in:
parent
5c875eeaed
commit
283db379c8
|
@ -56,10 +56,6 @@ impl super::ClipboardManager for MacClipboardManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_clipboard_image(&self, image_path: &Path) {
|
fn set_clipboard_image(&self, image_path: &Path) {
|
||||||
// Make sure the image exist beforehand
|
|
||||||
if !image_path.exists() {
|
|
||||||
error!("Image not found in path: {:?}", image_path);
|
|
||||||
}else{
|
|
||||||
let path_string = image_path.to_string_lossy().into_owned();
|
let path_string = image_path.to_string_lossy().into_owned();
|
||||||
let res = CString::new(path_string);
|
let res = CString::new(path_string);
|
||||||
if let Ok(path) = res {
|
if let Ok(path) = res {
|
||||||
|
@ -71,7 +67,6 @@ impl super::ClipboardManager for MacClipboardManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MacClipboardManager {
|
impl MacClipboardManager {
|
||||||
|
|
|
@ -219,8 +219,14 @@ impl <'a, S: KeyboardManager, C: ClipboardManager, M: ConfigManager<'a>, U: UIMa
|
||||||
// Image Match
|
// Image Match
|
||||||
MatchContentType::Image(content) => {
|
MatchContentType::Image(content) => {
|
||||||
let image_path = PathBuf::from(&content.path);
|
let image_path = PathBuf::from(&content.path);
|
||||||
|
|
||||||
|
// Make sure the image exist beforehand
|
||||||
|
if image_path.exists() {
|
||||||
self.clipboard_manager.set_clipboard_image(&image_path);
|
self.clipboard_manager.set_clipboard_image(&image_path);
|
||||||
self.keyboard_manager.trigger_paste();
|
self.keyboard_manager.trigger_paste();
|
||||||
|
}else{
|
||||||
|
error!("Image not found in path: {:?}", image_path);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user