move to json and another rename

This commit is contained in:
Fl1tzi 2023-05-23 20:48:44 +02:00
parent 0dfd2d5c39
commit 49786f25b7
2 changed files with 7 additions and 5 deletions

View file

@ -1,5 +1,5 @@
[package]
name = "virtual-deck"
name = "microdeck"
version = "0.1.0"
edition = "2021"
license = "MIT"
@ -7,11 +7,11 @@ license = "MIT"
[dependencies]
hidapi = "2.2.0"
deck-driver = { git = "https://codeberg.org/Fl1tzi/deck-driver.git", branch = "main", features = ["async"] }
toml = "0.7.2"
tokio = { version = "1", features = ["full"] }
log = "0.4"
dirs = "4.0.0"
serde = { version = "1.0", features = ["derive", "rc"] }
serde_json = "1.0"
image = "0.24.5"
async-trait = "0.1.66"
futures-util = "0.3.27"

View file

@ -10,9 +10,11 @@ use std::{
sync::Arc
};
use tracing::debug;
use serde_json;
/// The name of the folder which holds the config
pub const CONFIG_FOLDER_NAME: &'static str = "virtual-deck";
pub const CONFIG_FOLDER_NAME: &'static str = "microdeck";
pub const CONFIG_FILE: &'static str = "config.json";
#[derive(Deserialize, Debug)]
pub struct Config {
@ -58,7 +60,7 @@ pub fn load_config() -> Result<Config, ConfigError> {
// try to get the system config dir; env var required if not available
if let Some(mut path) = config_dir() {
path.push(CONFIG_FOLDER_NAME);
path.push("config.toml");
path.push(CONFIG_FILE);
debug!("Using system path: {:?}", path);
path
} else {
@ -71,7 +73,7 @@ pub fn load_config() -> Result<Config, ConfigError> {
match fs::read_to_string(config_file) {
Ok(content) => {
toml::from_str(&content).map_err(|e| ConfigError::SyntaxError(e.to_string()))
serde_json::from_str(&content).map_err(|e| ConfigError::SyntaxError(e.to_string()))
}
Err(file_error) => {
if file_error.kind() == ErrorKind::NotFound {