Remove unreachable config persistence
This commit is contained in:
@@ -59,6 +59,9 @@ Each bounded iteration must:
|
||||
## Configuration and application state
|
||||
|
||||
- [x] Apply `log_level` from configuration, with `RUST_LOG` as an explicit override (2026-09-10).
|
||||
- [x] Remove unreachable configuration persistence methods; configuration is
|
||||
currently load-and-validate only, matching the actual application surface
|
||||
(24 X11-feature tests and Docker GTK/X11/package build, 2026-09-12).
|
||||
- [x] Remove the unimplemented `popup_position` setting (2026-09-10).
|
||||
- [x] Validate zero/invalid limits and malformed shortcuts with actionable errors (16 core tests and Docker GTK/X11 build, 2026-09-10).
|
||||
- [x] Ensure configured history, pinned, and byte limits are applied consistently (16 tests and Docker GTK/X11 build, 2026-09-10).
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use anyhow::{Context, Result};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde::Deserialize;
|
||||
use std::{fs, os::unix::fs::PermissionsExt, path::PathBuf};
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
|
||||
#[serde(default)]
|
||||
pub struct Config {
|
||||
pub history_limit: usize,
|
||||
@@ -72,22 +72,6 @@ impl Config {
|
||||
}
|
||||
validate_shortcut(&self.global_shortcut)
|
||||
}
|
||||
pub fn ensure_parent(&self) -> Result<()> {
|
||||
if let Some(parent) = Self::path().parent() {
|
||||
fs::create_dir_all(parent).context("failed to create configuration directory")?;
|
||||
fs::set_permissions(parent, fs::Permissions::from_mode(0o700))
|
||||
.context("failed to restrict configuration directory")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
pub fn save(&self) -> Result<()> {
|
||||
self.ensure_parent()?;
|
||||
let path = Self::path();
|
||||
fs::write(&path, toml::to_string_pretty(self)?).context("failed to write configuration")?;
|
||||
fs::set_permissions(path, fs::Permissions::from_mode(0o600))
|
||||
.context("failed to restrict configuration permissions")?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user