mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-27 23:19:02 +08:00
more flexible for --get-id
This commit is contained in:
parent
8f851bc781
commit
9967bb993f
@ -102,7 +102,7 @@ pub fn core_main() -> Option<Vec<String>> {
|
||||
}
|
||||
if args.len() > 0 && args[0] == "--version" {
|
||||
// not use my_println here, because check super use using this command, no dialog expected
|
||||
println!("{}", crate::VERSION);
|
||||
my_println!("{}", crate::VERSION);
|
||||
return None;
|
||||
}
|
||||
#[cfg(windows)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![cfg_attr(
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
all(target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
|
||||
|
@ -2301,16 +2301,30 @@ mod tests {
|
||||
|
||||
pub fn message_box(text: &str) {
|
||||
let mut text = text.to_owned();
|
||||
if !text.ends_with("!") {
|
||||
let nodialog = std::env::var("NO_DIALOG").unwrap_or_default() == "Y";
|
||||
if !text.ends_with("!") || nodialog {
|
||||
use arboard::Clipboard as ClipboardContext;
|
||||
match ClipboardContext::new() {
|
||||
Ok(mut ctx) => {
|
||||
ctx.set_text(&text).ok();
|
||||
if !nodialog {
|
||||
text = format!("{}\n\nAbove text has been copied to clipboard", &text);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
if nodialog {
|
||||
if std::env::var("PRINT_OUT").unwrap_or_default() == "Y" {
|
||||
println!("{text}");
|
||||
}
|
||||
if let Ok(x) = std::env::var("WRITE_TO_FILE") {
|
||||
if !x.is_empty() {
|
||||
allow_err!(std::fs::write(x, text));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
let text = text
|
||||
.encode_utf16()
|
||||
.chain(std::iter::once(0))
|
||||
|
Loading…
Reference in New Issue
Block a user