mirror of
https://codeberg.org/Fl1tzi/microdeck.git
synced 2024-05-05 21:22:46 +00:00
move to json and another rename
This commit is contained in:
parent
0dfd2d5c39
commit
49786f25b7
|
@ -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"
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue