patch: make linux build ok

Signed-off-by: ClSlaid <cailue@bupt.edu.cn>
This commit is contained in:
ClSlaid
2023-10-29 23:35:55 +08:00
parent 7aee76f5de
commit 30e85c8654
8 changed files with 55 additions and 48 deletions

View File

@@ -40,7 +40,6 @@ use utf16string::WStr;
use crate::{send_data, ClipboardFile, CliprdrError};
#[cfg(target_os = "linux")]
use super::LDAP_EPOCH_DELTA;
/// fuse server ready retry max times

View File

@@ -21,7 +21,7 @@ pub mod fuse;
#[cfg(feature = "unix-file-copy-paste")]
#[cfg(any(target_os = "linux", target_os = "macos"))]
pub mod unix;
#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "macos"))]
pub fn create_cliprdr_context(
_enable_files: bool,
_enable_others: bool,
@@ -52,11 +52,11 @@ pub fn create_cliprdr_context(
log::warn!("umount {:?} may fail: {:?}", mnt_path, e);
}
let linux_ctx = unix::ClipboardContext::new(timeout, mnt_path.parse().unwrap())?;
let unix_ctx = unix::ClipboardContext::new(timeout, mnt_path.parse().unwrap())?;
log::debug!("start cliprdr FUSE");
linux_ctx.run().expect("failed to start cliprdr FUSE");
unix_ctx.run().expect("failed to start cliprdr FUSE");
Ok(Box::new(linux_ctx) as Box<_>)
Ok(Box::new(unix_ctx) as Box<_>)
}
#[cfg(not(feature = "unix-file-copy-paste"))]
return Ok(Box::new(DummyCliprdrContext {}) as Box<_>);
@@ -83,5 +83,4 @@ impl CliprdrServiceContext for DummyCliprdrContext {
#[cfg(feature = "unix-file-copy-paste")]
// begin of epoch used by microsoft
// 1601-01-01 00:00:00 + LDAP_EPOCH_DELTA*(100 ns) = 1970-01-01 00:00:00
#[cfg(target_os = "linux")]
const LDAP_EPOCH_DELTA: u64 = 116444772610000000;

View File

@@ -19,14 +19,17 @@ use crate::{
};
use self::local_file::LocalFile;
#[cfg(target_os = "linux")]
use self::url::{encode_path_to_uri, parse_plain_uri_list};
use super::fuse::FuseServer;
#[cfg(not(feature = "wayland"))]
#[cfg(target_os = "linux")]
pub mod x11;
pub mod local_file;
#[cfg(target_os = "linux")]
pub mod url;
// not actual format id, just a placeholder
@@ -66,6 +69,7 @@ trait SysClipboard: Send + Sync {
fn get_file_list(&self) -> Vec<PathBuf>;
}
#[cfg(target_os = "linux")]
fn get_sys_clipboard(ignore_path: &PathBuf) -> Result<Box<dyn SysClipboard>, CliprdrError> {
#[cfg(feature = "wayland")]
{
@@ -79,6 +83,11 @@ fn get_sys_clipboard(ignore_path: &PathBuf) -> Result<Box<dyn SysClipboard>, Cli
}
}
#[cfg(target_os = "macos")]
fn get_sys_clipboard(ignore_path: &PathBuf) -> Result<Box<dyn SysClipboard>, CliprdrError> {
unimplemented!()
}
#[derive(Debug)]
enum FileContentsRequest {
Size {