44 lines
1.2 KiB
Rust
Executable file
44 lines
1.2 KiB
Rust
Executable file
use app::App;
|
|
use color_eyre::eyre;
|
|
use console::ProcessMode;
|
|
use eframe::NativeOptions;
|
|
use egui::ViewportBuilder;
|
|
|
|
mod app;
|
|
pub(crate) mod console;
|
|
mod errors;
|
|
mod logging;
|
|
|
|
fn main() -> eyre::Result<()> {
|
|
let process_mode = ProcessMode::from_current_process()?;
|
|
|
|
crate::errors::init()?;
|
|
crate::logging::init(process_mode)?;
|
|
tracing::info!(concat!(
|
|
env!("CARGO_PKG_NAME"),
|
|
" v",
|
|
env!("CARGO_PKG_VERSION")
|
|
));
|
|
|
|
match process_mode {
|
|
ProcessMode::Console(_) => process_mode.detach_to_gui()?,
|
|
ProcessMode::Gui => {
|
|
tracing::info!("Attempting to natively render UI");
|
|
eframe::run_native(
|
|
"portable-msvc-rs",
|
|
NativeOptions {
|
|
viewport: ViewportBuilder::default()
|
|
.with_resizable(false)
|
|
.with_inner_size(egui::vec2(420.0, 200.0))
|
|
.with_maximize_button(false)
|
|
.with_minimize_button(false),
|
|
..Default::default()
|
|
},
|
|
Box::new(|_cc| Ok(Box::new(App::default()))),
|
|
)
|
|
.unwrap();
|
|
}
|
|
}
|
|
|
|
Ok(())
|
|
}
|