Fixed UI start without console window on Windows on Rust 1.56.0.
This commit is contained in:
+6
-2
@@ -35,11 +35,13 @@ const SETTINGS_FILENAME: &str = "alfis.toml";
|
|||||||
const LOG_TARGET_MAIN: &str = "alfis::Main";
|
const LOG_TARGET_MAIN: &str = "alfis::Main";
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
#[allow(unused_assignments)]
|
||||||
|
let mut use_logger = true;
|
||||||
// When linked with the windows subsystem windows won't automatically attach
|
// When linked with the windows subsystem windows won't automatically attach
|
||||||
// to the console of the parent process, so we do it explicitly. This fails silently if the parent has no console.
|
// to the console of the parent process, so we do it explicitly. This fails silently if the parent has no console.
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
unsafe {
|
unsafe {
|
||||||
AttachConsole(ATTACH_PARENT_PROCESS);
|
use_logger = AttachConsole(ATTACH_PARENT_PROCESS) != 0;
|
||||||
#[cfg(feature = "webgui")]
|
#[cfg(feature = "webgui")]
|
||||||
winapi::um::shellscalingapi::SetProcessDpiAwareness(2);
|
winapi::um::shellscalingapi::SetProcessDpiAwareness(2);
|
||||||
}
|
}
|
||||||
@@ -108,7 +110,9 @@ fn main() {
|
|||||||
Some(path) => path
|
Some(path) => path
|
||||||
};
|
};
|
||||||
|
|
||||||
setup_logger(&opt_matches);
|
if use_logger {
|
||||||
|
setup_logger(&opt_matches);
|
||||||
|
}
|
||||||
if let Some(status) = opt_matches.opt_str("s") {
|
if let Some(status) = opt_matches.opt_str("s") {
|
||||||
register(move |_, event| {
|
register(move |_, event| {
|
||||||
match event {
|
match event {
|
||||||
|
|||||||
Reference in New Issue
Block a user