Use config folder (#110)

This commit is contained in:
Philip Kristoffersen
2022-05-01 07:14:24 +02:00
committed by GitHub
parent 44bebfc59e
commit 9fdf56d5ed
9 changed files with 117 additions and 18 deletions
+2 -3
View File
@@ -4,6 +4,7 @@ use std::{
};
use crate::{
config::get_thumbnails_folder,
steam::{get_shortcuts_paths, SteamUsersInfo},
steamgriddb::{get_query_type, CachedSearch, ImageType, ToDownload},
};
@@ -399,8 +400,6 @@ impl MyEguiApp {
}
fn handle_image_type_selected(&mut self, image_type: ImageType) {
let _ = std::fs::create_dir_all(".thumbnails");
let state = &mut self.image_selected_state;
state.image_type_selected = Some(image_type);
let (tx, rx) = watch::channel(FetcStatus::Fetching);
@@ -411,7 +410,7 @@ impl MyEguiApp {
let auth_key = auth_key;
let image_type = image_type;
self.rt.spawn_blocking(move || {
let thumbnails_folder = Path::new(".thumbnails");
let thumbnails_folder = get_thumbnails_folder();
let client = steamgriddb_api::Client::new(auth_key);
let query = get_query_type(false, &image_type);
let search_res = block_on(client.get_images_for_id(grid_id, &query));
+3 -2
View File
@@ -127,8 +127,9 @@ impl MyEguiApp {
});
}
fn save_settings_to_file(settings: &Settings) {
pub fn save_settings_to_file(settings: &Settings) {
let toml = toml::to_string(&settings).unwrap();
std::fs::write("config.toml", toml).unwrap();
let config_path = crate::config::get_config_file();
std::fs::write(config_path, toml).unwrap();
}
}