-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: unable to build on android using termux (#222)
- Loading branch information
Showing
4 changed files
with
28 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#[cfg(not(any(target_os = "android", target_os = "emscripten")))] | ||
lazy_static::lazy_static! { | ||
static ref CLIPBOARD: std::sync::Arc<std::sync::Mutex<Option<arboard::Clipboard>>> = | ||
std::sync::Arc::new(std::sync::Mutex::new(arboard::Clipboard::new().ok())); | ||
} | ||
|
||
#[cfg(not(any(target_os = "android", target_os = "emscripten")))] | ||
pub fn set_text(text: &str) -> anyhow::Result<()> { | ||
let mut clipboard = CLIPBOARD.lock().unwrap(); | ||
match clipboard.as_mut() { | ||
Some(clipboard) => clipboard.set_text(text)?, | ||
None => anyhow::bail!("No available clipboard"), | ||
} | ||
Ok(()) | ||
} | ||
|
||
#[cfg(any(target_os = "android", target_os = "emscripten"))] | ||
pub fn set_text(_text: &str) -> anyhow::Result<()> { | ||
anyhow::bail!("No available clipboard") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters