mirror of
https://codeberg.org/Fl1tzi/microdeck.git
synced 2024-05-18 18:52:10 +00:00
move to json and another rename
This commit is contained in:
parent
0dfd2d5c39
commit
49786f25b7
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "virtual-deck"
|
name = "microdeck"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
@ -7,11 +7,11 @@ license = "MIT"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
hidapi = "2.2.0"
|
hidapi = "2.2.0"
|
||||||
deck-driver = { git = "https://codeberg.org/Fl1tzi/deck-driver.git", branch = "main", features = ["async"] }
|
deck-driver = { git = "https://codeberg.org/Fl1tzi/deck-driver.git", branch = "main", features = ["async"] }
|
||||||
toml = "0.7.2"
|
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
dirs = "4.0.0"
|
dirs = "4.0.0"
|
||||||
serde = { version = "1.0", features = ["derive", "rc"] }
|
serde = { version = "1.0", features = ["derive", "rc"] }
|
||||||
|
serde_json = "1.0"
|
||||||
image = "0.24.5"
|
image = "0.24.5"
|
||||||
async-trait = "0.1.66"
|
async-trait = "0.1.66"
|
||||||
futures-util = "0.3.27"
|
futures-util = "0.3.27"
|
||||||
|
|
|
@ -10,9 +10,11 @@ use std::{
|
||||||
sync::Arc
|
sync::Arc
|
||||||
};
|
};
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
use serde_json;
|
||||||
|
|
||||||
/// The name of the folder which holds the config
|
/// 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)]
|
#[derive(Deserialize, Debug)]
|
||||||
pub struct Config {
|
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
|
// try to get the system config dir; env var required if not available
|
||||||
if let Some(mut path) = config_dir() {
|
if let Some(mut path) = config_dir() {
|
||||||
path.push(CONFIG_FOLDER_NAME);
|
path.push(CONFIG_FOLDER_NAME);
|
||||||
path.push("config.toml");
|
path.push(CONFIG_FILE);
|
||||||
debug!("Using system path: {:?}", path);
|
debug!("Using system path: {:?}", path);
|
||||||
path
|
path
|
||||||
} else {
|
} else {
|
||||||
|
@ -71,7 +73,7 @@ pub fn load_config() -> Result<Config, ConfigError> {
|
||||||
|
|
||||||
match fs::read_to_string(config_file) {
|
match fs::read_to_string(config_file) {
|
||||||
Ok(content) => {
|
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) => {
|
Err(file_error) => {
|
||||||
if file_error.kind() == ErrorKind::NotFound {
|
if file_error.kind() == ErrorKind::NotFound {
|
||||||
|
|
Loading…
Reference in a new issue