mirror of
https://gitverse.ru/ot/DownOnSpot
synced 2025-12-19 18:04:16 +00:00
Format with rustfmt
This commit is contained in:
parent
dbe6e6bc6c
commit
40d65a7213
1 changed files with 42 additions and 45 deletions
|
|
@ -3,14 +3,14 @@ use crate::error::SpotifyError;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use tokio::{
|
use tokio::{
|
||||||
fs::File,
|
|
||||||
fs::create_dir_all,
|
fs::create_dir_all,
|
||||||
|
fs::File,
|
||||||
io::{AsyncReadExt, AsyncWriteExt},
|
io::{AsyncReadExt, AsyncWriteExt},
|
||||||
};
|
};
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
env,
|
env,
|
||||||
path::{Path,PathBuf},
|
path::{Path, PathBuf},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Structure for holding all the settings
|
// Structure for holding all the settings
|
||||||
|
|
@ -29,11 +29,9 @@ pub struct Settings {
|
||||||
#[cfg(target_family = "unix")]
|
#[cfg(target_family = "unix")]
|
||||||
fn get_config_folder_path() -> PathBuf {
|
fn get_config_folder_path() -> PathBuf {
|
||||||
match env::var("XDG_CONFIG_HOME") {
|
match env::var("XDG_CONFIG_HOME") {
|
||||||
|
|
||||||
Ok(v) => Path::new(&v).join("down_on_spot").to_path_buf(),
|
Ok(v) => Path::new(&v).join("down_on_spot").to_path_buf(),
|
||||||
|
|
||||||
Err(_) => Path::new(&env::var("HOME").unwrap()).join(".config/down_on_spot"),
|
Err(_) => Path::new(&env::var("HOME").unwrap()).join(".config/down_on_spot"),
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,7 +61,6 @@ impl Settings {
|
||||||
create_dir_all(&config_folder_path).await?;
|
create_dir_all(&config_folder_path).await?;
|
||||||
let config_file_path = config_folder_path.join("settings.json");
|
let config_file_path = config_folder_path.join("settings.json");
|
||||||
|
|
||||||
|
|
||||||
// Serialize the settings to a json file
|
// Serialize the settings to a json file
|
||||||
let data = serde_json::to_string_pretty(self)?;
|
let data = serde_json::to_string_pretty(self)?;
|
||||||
let mut file = File::create(config_file_path).await?;
|
let mut file = File::create(config_file_path).await?;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue