Create files for configuration

This commit is contained in:
Philip Kristoffersen
2021-09-24 23:08:35 +02:00
parent 517cf87d87
commit 60dd680c33
8 changed files with 221 additions and 7 deletions
+1
View File
@@ -1,4 +1,5 @@
mod get_manifests;
mod manifest_item;
mod settings;
pub use manifest_item::*;
pub use get_manifests::get_egs_manifests;
+29
View File
@@ -0,0 +1,29 @@
use serde::Deserialize;
#[derive(Debug, Deserialize)]
struct EpicGamesLauncher {
enabled: bool,
location: Option<String>,
}
impl Default for EpicGamesLauncher {
fn default() -> Self {
// On windows
// Even if no path is given, we can try to guess, so lets enable by default
#[cfg(target_os = "windows")]
let enabled = true;
// On linux
// We can notguess, so lets not enable by default
#[cfg(target_os = "linux")]
let enabled = false;
EpicGamesLauncher {
enabled,
location: None,
}
}
}
+2
View File
@@ -9,6 +9,8 @@ use std::{
mod cached_search;
mod egs;
mod legendary;
mod steamgriddb;
use crate::legendary::get_legendary_games;
use egs::{get_egs_manifests, ManifestItem};
use std::error::Error;
+18
View File
@@ -0,0 +1,18 @@
use std::env;
use config::{ConfigError, Config, File, Environment};
#[derive(Debug, Deserialize)]
pub struct Settings {
debug: bool,
database: EpicGamesLauncher,
}
//https://github.com/JosefNemec/Playnite/tree/master/source/Plugins/OriginLibrary
//https://github.com/JosefNemec/Playnite/blob/master/source/Plugins/OriginLibrary/Origin.cs#L109
impl Settings {
pub fn new() -> Result<Self, ConfigError> {
}
}
+2
View File
@@ -0,0 +1,2 @@
mod settings;
pub use settings::*;
+16
View File
@@ -0,0 +1,16 @@
use serde::Deserialize;
#[derive(Debug, Deserialize)]
pub struct SteamGridDb {
pub enabled: bool,
pub auth_key: Option<String>,
}
impl Default for SteamGridDb {
fn default() -> Self {
Self {
enabled: true,
auth_key: None,
}
}
}