[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:
2026-04-03 19:33:11 +02:00
parent c8a5e15b3b
commit ced77464f9
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -25,14 +25,14 @@ use trx_core::decode::{AprsPacket, CwEvent, Ft8Message, WefaxMessage, WsprMessag
// ---------------------------------------------------------------------------
fn default_decode_logs_dir() -> String {
if let Some(data_dir) = dirs::data_dir() {
return data_dir
if let Some(cache_dir) = dirs::cache_dir() {
return cache_dir
.join("trx-rs")
.join("decoders")
.to_string_lossy()
.to_string();
}
"logs/decoders".to_string()
".cache/trx-rs/decoders".to_string()
}
/// Server-side decoder file logging configuration.
@@ -28,7 +28,7 @@ use tracing::{error, info, warn};
pub struct RecorderConfig {
/// Whether the recorder feature is available.
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>,
/// Maximum duration of a single recording in seconds. None = unlimited.
pub max_duration_secs: Option<u64>,
@@ -49,8 +49,8 @@ impl RecorderConfig {
if let Some(ref dir) = self.output_dir {
PathBuf::from(dir)
} else {
dirs::data_dir()
.unwrap_or_else(|| PathBuf::from("."))
dirs::cache_dir()
.unwrap_or_else(|| PathBuf::from(".cache"))
.join("trx-rs")
.join("recordings")
}