diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-07-15 07:13:03 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-07-15 07:13:03 +0200 |
commit | 46329283ef91d023c07aecd856889d496dc69471 (patch) | |
tree | dc9c4c326d32cc846caf72f343313fe49a7dd14c /crates | |
parent | feat(crates/yt/update): Make the concurrency configurable (diff) | |
download | yt-46329283ef91d023c07aecd856889d496dc69471.zip |
refactor(crates/yt/config): Always use imported paths in config dec
Diffstat (limited to 'crates')
-rw-r--r-- | crates/yt/src/config/mod.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/crates/yt/src/config/mod.rs b/crates/yt/src/config/mod.rs index 4a9fa94..756a7f5 100644 --- a/crates/yt/src/config/mod.rs +++ b/crates/yt/src/config/mod.rs @@ -6,10 +6,15 @@ mod support; mk_config! { use std::path::PathBuf; use std::io::IsTerminal; + use std::time::Duration; use crate::shared::bytes::Bytes; + use super::paths::get_config_path; + use super::paths::get_runtime_path; + use super::paths::get_data_path; use super::paths::ensure_parent_dir; + use super::paths::PREFIX; struct Config { global: GlobalConfig = { @@ -42,25 +47,25 @@ mk_config! { // We download to the temp dir to avoid taxing the disk let temp_dir = std::env::temp_dir(); - temp_dir.join(super::paths::PREFIX) + temp_dir.join(PREFIX) } => ensure_parent_dir, /// Path to the mpv configuration file. - mpv_config_path: PathBuf =? super::paths::get_config_path("mpv.conf") => ensure_parent_dir, + mpv_config_path: PathBuf =? get_config_path("mpv.conf") => ensure_parent_dir, /// Path to the mpv input configuration file. - mpv_input_path: PathBuf =? super::paths::get_config_path("mpv.input.conf") => ensure_parent_dir, + mpv_input_path: PathBuf =? get_config_path("mpv.input.conf") => ensure_parent_dir, /// Which path to use for mpv ipc socket creation. - mpv_ipc_socket_path: PathBuf =? super::paths::get_runtime_path("mpv.ipc.socket") => ensure_parent_dir, + mpv_ipc_socket_path: PathBuf =? get_runtime_path("mpv.ipc.socket") => ensure_parent_dir, /// Path to the video database. database_path: PathBuf where db_path: Option<PathBuf> =! {|config_value: Option<PathBuf>| { - db_path.map_or_else(|| config_value.map_or_else(|| super::paths::get_data_path("videos.sqlite"), Ok), Ok) + db_path.map_or_else(|| config_value.map_or_else(|| get_data_path("videos.sqlite"), Ok), Ok) }} => ensure_parent_dir, /// Where to store the selection file before applying it. - last_selection_path: PathBuf =? super::paths::get_runtime_path("selected.yts") => ensure_parent_dir, + last_selection_path: PathBuf =? get_runtime_path("selected.yts") => ensure_parent_dir, }, download: DownloadConfig = { /// The maximum cache size. |