Fix second audit findings and restore crash detection dialog

This commit is contained in:
2026-02-27 22:48:43 +02:00
parent 804ba35a70
commit 011c07820d
21 changed files with 228 additions and 181 deletions

View File

@@ -1,4 +1,25 @@
use std::path::PathBuf;
pub const APP_ID: &str = "app.driftwood.Driftwood";
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub const GSETTINGS_SCHEMA_DIR: &str = env!("GSETTINGS_SCHEMA_DIR");
pub const SYSTEM_APPIMAGE_DIR: &str = "/opt/appimages";
/// Return the XDG data directory with a proper $HOME-based fallback.
/// Unlike `PathBuf::from("~/.local/share")`, this actually resolves to the
/// user's home directory instead of creating a literal `~` path.
pub fn data_dir_fallback() -> PathBuf {
dirs::data_dir().unwrap_or_else(|| home_dir().join(".local/share"))
}
/// Return the XDG config directory with a proper $HOME-based fallback.
#[allow(dead_code)]
pub fn config_dir_fallback() -> PathBuf {
dirs::config_dir().unwrap_or_else(|| home_dir().join(".config"))
}
fn home_dir() -> PathBuf {
dirs::home_dir()
.or_else(|| std::env::var("HOME").ok().map(PathBuf::from))
.unwrap_or_else(|| PathBuf::from("/tmp"))
}