From ced77464f9b359d6311942509d51f2793e964c5e Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Fri, 3 Apr 2026 19:33:11 +0200 Subject: [PATCH] [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) Signed-off-by: Stan Grams --- src/decoders/trx-decode-log/src/lib.rs | 6 +++--- .../trx-frontend/trx-frontend-http/src/recorder.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/decoders/trx-decode-log/src/lib.rs b/src/decoders/trx-decode-log/src/lib.rs index 8c9a627..0f14d29 100644 --- a/src/decoders/trx-decode-log/src/lib.rs +++ b/src/decoders/trx-decode-log/src/lib.rs @@ -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. diff --git a/src/trx-client/trx-frontend/trx-frontend-http/src/recorder.rs b/src/trx-client/trx-frontend/trx-frontend-http/src/recorder.rs index 1f6ac4f..fd88d9f 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/src/recorder.rs +++ b/src/trx-client/trx-frontend/trx-frontend-http/src/recorder.rs @@ -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, /// Maximum duration of a single recording in seconds. None = unlimited. pub max_duration_secs: Option, @@ -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") }