Files
DarkRoom/platform/dr-plat/src/lib.rs
T
dtourolle ef1154af94 Resolve every base directory in one place, and on Windows
Five sites each read XDG_*_HOME and fell back to $HOME/.local/… on
their own, which is fine on Linux and wrong everywhere else: Windows
sets neither variable, so every one of them degraded to a path
relative to the working directory — for a Start Menu launch,
C:\Windows\System32. The models lookup walked XDG_DATA_DIRS the same
way.

dr_plat::dirs now holds the rule per platform: XDG on Unix, the known
folders on Windows — %APPDATA% for config, which roams, and
%LOCALAPPDATA% for data and state, which do not — and the executable's
own directory as the system data dir, which is where the installer
puts the models. The Android overrides stay where they were; only the
fallback behind them moved. Both rule sets are unit-tested on either
host, and the Windows one was confirmed by running the application
under Wine: its log landed in AppData\Local\darkroom\state and nothing
was written anywhere else.
2026-09-12 07:34:05 +02:00

39 lines
1.4 KiB
Rust

//! Platform abstraction for DarkRoom.
//!
//! Traits are defined here and implemented per platform, then injected at
//! construction, so `core/` contains no `#[cfg(target_os)]` (NFR-PORT-1,
//! ARCH §10).
// Neither of the next two is a trait, and they are the modules here that are
// not. They belong in this crate for the same reason the traits do: "where does
// this platform let an application keep state" is a platform question, and both
// entry points need the answer before either has a window. Resolving it in
// `apps/` would mean writing it twice, once per platform, which is the
// arrangement this crate exists to prevent.
pub mod crash;
pub mod diagnostics;
pub mod dirs;
pub mod display;
pub mod input;
pub mod secrets;
pub mod state;
pub mod storage;
pub mod volumes;
pub use diagnostics::{Installed, LogFile};
pub use dirs::{base_dir, system_data_dirs, Base};
pub use display::{
Bounds, DisplayInfo, DisplayProfile, DisplayServer, DisplaySurvey, FallbackReason,
ProfileSource,
};
pub use input::is_touch_first;
pub use secrets::{
EphemeralSecretStore, PlatformSecretStore, SecretError, SecretKind, SecretRef, SecretStore,
};
pub use state::{set_state_dir, state_dir};
pub use storage::{
DirRef, Entry, LocalStorage, NewFile, Node, SeekableRead, Storage, StorageError,
WritableStorage,
};
pub use volumes::{imports_supported, volumes, Volume};