[fix](trx-rs): use cache_dir for recordings and decode logs
Move default output directories from $XDG_DATA_HOME to $XDG_CACHE_HOME so all runtime data lives under ~/.cache/trx-rs/ consistently. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -25,14 +25,14 @@ use trx_core::decode::{AprsPacket, CwEvent, Ft8Message, WefaxMessage, WsprMessag
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
fn default_decode_logs_dir() -> String {
|
fn default_decode_logs_dir() -> String {
|
||||||
if let Some(data_dir) = dirs::data_dir() {
|
if let Some(cache_dir) = dirs::cache_dir() {
|
||||||
return data_dir
|
return cache_dir
|
||||||
.join("trx-rs")
|
.join("trx-rs")
|
||||||
.join("decoders")
|
.join("decoders")
|
||||||
.to_string_lossy()
|
.to_string_lossy()
|
||||||
.to_string();
|
.to_string();
|
||||||
}
|
}
|
||||||
"logs/decoders".to_string()
|
".cache/trx-rs/decoders".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Server-side decoder file logging configuration.
|
/// Server-side decoder file logging configuration.
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ use tracing::{error, info, warn};
|
|||||||
pub struct RecorderConfig {
|
pub struct RecorderConfig {
|
||||||
/// Whether the recorder feature is available.
|
/// Whether the recorder feature is available.
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
/// Directory for recorded files. Default: `$XDG_DATA_HOME/trx-rs/recordings/`.
|
/// Directory for recorded files. Default: `$XDG_CACHE_HOME/trx-rs/recordings/`.
|
||||||
pub output_dir: Option<String>,
|
pub output_dir: Option<String>,
|
||||||
/// Maximum duration of a single recording in seconds. None = unlimited.
|
/// Maximum duration of a single recording in seconds. None = unlimited.
|
||||||
pub max_duration_secs: Option<u64>,
|
pub max_duration_secs: Option<u64>,
|
||||||
@@ -49,8 +49,8 @@ impl RecorderConfig {
|
|||||||
if let Some(ref dir) = self.output_dir {
|
if let Some(ref dir) = self.output_dir {
|
||||||
PathBuf::from(dir)
|
PathBuf::from(dir)
|
||||||
} else {
|
} else {
|
||||||
dirs::data_dir()
|
dirs::cache_dir()
|
||||||
.unwrap_or_else(|| PathBuf::from("."))
|
.unwrap_or_else(|| PathBuf::from(".cache"))
|
||||||
.join("trx-rs")
|
.join("trx-rs")
|
||||||
.join("recordings")
|
.join("recordings")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user