mirror of
https://github.com/djibux/BoilR.git
synced 2026-09-01 05:53:41 +02:00
Make UI default, and remove CLI version (#83)
This commit is contained in:
+1
-24
@@ -11,38 +11,15 @@ mod steam;
|
||||
mod steamgriddb;
|
||||
mod sync;
|
||||
mod uplay;
|
||||
|
||||
#[cfg(feature = "ui")]
|
||||
mod ui;
|
||||
|
||||
use std::error::Error;
|
||||
|
||||
#[cfg(not(feature = "ui"))]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
let settings = settings::Settings::new()?;
|
||||
if settings.steam.stop_steam{
|
||||
crate::steam::ensure_steam_stopped();
|
||||
}
|
||||
settings::Settings::write_config_if_missing();
|
||||
let usersinfo = sync::run_sync(&settings,&mut None).unwrap();
|
||||
sync::download_images(&settings,&usersinfo,&mut None).await;
|
||||
if settings.steam.start_steam{
|
||||
crate::steam::ensure_steam_started(&settings.steam);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(feature = "ui")]
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
let mut args = std::env::args();
|
||||
if args.len() > 1 && args.nth(1).unwrap_or_default() == "--no-ui" {
|
||||
ui::run_sync();
|
||||
Ok(())
|
||||
}else{
|
||||
ui::run_ui()
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,20 +54,6 @@ impl Settings {
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
pub fn write_config_if_missing() {
|
||||
let config_path = std::path::Path::new("config.toml");
|
||||
if !config_path.exists() {
|
||||
let worked = std::fs::write(config_path, include_str!("defaultconfig.toml"));
|
||||
match worked {
|
||||
Ok(_) => println!("Create configuration file at {:?}", &config_path),
|
||||
Err(err) => println!(
|
||||
"Could not create configuration file at {:?}, reason: {:?}",
|
||||
&config_path, err
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn sanitize_auth_key(result: &mut Result<Settings, ConfigError>) {
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ impl MyEguiApp {
|
||||
}
|
||||
}
|
||||
pub fn run_sync(&mut self) {
|
||||
let (sender,mut reciever ) = watch::channel(SyncProgress::NotStarted);
|
||||
let (sender,reciever ) = watch::channel(SyncProgress::NotStarted);
|
||||
let settings = self.settings.clone();
|
||||
if settings.steam.stop_steam{
|
||||
crate::steam::ensure_steam_stopped();
|
||||
@@ -376,7 +376,7 @@ pub fn run_ui() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
let mut native_options = eframe::NativeOptions::default();
|
||||
native_options.initial_window_size = Some(egui::Vec2{
|
||||
x:500.,
|
||||
x:800.,
|
||||
y:500.
|
||||
});
|
||||
native_options.icon_data = Some(get_logo_icon());
|
||||
|
||||
Reference in New Issue
Block a user