mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-18 19:25:56 +00:00
14 lines
461 B
Rust
14 lines
461 B
Rust
use std::path::Path;
|
|
|
|
pub fn close_to_tray(dir: &Path) -> coa_core::Result<bool> {
|
|
match std::fs::read(dir.join("close-to-tray.json")) {
|
|
Ok(bytes) => Ok(serde_json::from_slice(&bytes)?),
|
|
Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(false),
|
|
Err(e) => Err(e.into()),
|
|
}
|
|
}
|
|
|
|
pub fn save(dir: &Path, enabled: bool) -> coa_core::Result<()> {
|
|
coa_core::fsx::atomic_write_json(&dir.join("close-to-tray.json"), &enabled)
|
|
}
|