Skip to content

Commit 1122f24

Browse files
committed
Keep runtime files in default data_dir when --config points to default path
When the GUI launches the daemon with an explicit --config that resolves to the platform default config path, AppPaths::resolve treated it as an override and fell back to placing runtime/ next to the config file (e.g. ~/.config/linuxdo-accelerator/runtime/) instead of the default data_dir (~/.local/share/linuxdo-accelerator/runtime/). That left two operations.log files in different places depending on which command issued the request. Treat --config as an explicit override only when the supplied path differs from the default config path.
1 parent 2303dd4 commit 1122f24

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/paths.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub struct AppPaths {
2424
impl AppPaths {
2525
pub fn resolve(config_override: Option<PathBuf>) -> Result<Self> {
2626
let (default_config_dir, default_data_dir) = default_app_dirs()?;
27+
let default_config_path = default_config_dir.join("linuxdo-accelerator.toml");
2728
let has_config_override = config_override.is_some();
2829
let config_path =
2930
config_override.unwrap_or_else(|| default_config_dir.join("linuxdo-accelerator.toml"));
@@ -32,7 +33,8 @@ impl AppPaths {
3233
.map(Path::to_path_buf)
3334
.ok_or_else(|| anyhow!("invalid config path {}", config_path.display()))?;
3435

35-
let data_dir = if has_config_override {
36+
let is_explicit_override = has_config_override && config_path != default_config_path;
37+
let data_dir = if is_explicit_override {
3638
if config_dir
3739
.file_name()
3840
.and_then(|name| name.to_str())

0 commit comments

Comments
 (0)