Validate settings before run

This commit is contained in:
Philip Kristoffersen
2021-11-03 08:47:34 +01:00
parent 46e14f8192
commit 37a18fb3be
7 changed files with 62 additions and 4 deletions
+10 -1
View File
@@ -1,7 +1,7 @@
use super::butler_db_parser::*;
use super::receipt::Receipt;
use super::{ItchGame, ItchSettings};
use crate::platform::Platform;
use crate::platform::{Platform, SettingsValidity};
use failure::*;
use flate2::read::GzDecoder;
use std::collections::HashSet;
@@ -59,6 +59,15 @@ impl Platform<ItchGame, ItchErrors> for ItchPlatform {
fn create_symlinks(&self) -> bool {
self.settings.create_symlinks
}
fn settings_valid(&self) -> crate::platform::SettingsValidity {
let shortcuts_res = self.get_shortcuts();
match shortcuts_res {
Ok(_) => SettingsValidity::Valid,
Err(err) => SettingsValidity::Invalid{reason:format!("{}",err)}
}
}
}
fn dbpath_to_game(paths: &DbPaths<'_>) -> Option<ItchGame> {