Keep private sidecar profile data transient

This commit is contained in:
2026-05-08 22:25:31 -04:00
parent 8334fcbd6e
commit 1c960af094
9 changed files with 266 additions and 80 deletions
@@ -1,4 +1,8 @@
use std::path::{Path, PathBuf};
use std::{
env,
path::{Path, PathBuf},
time::{SystemTime, SystemTimeError, UNIX_EPOCH},
};
use directories::ProjectDirs;
use ely_domain::ProfileId;
@@ -15,3 +19,20 @@ pub(super) fn default_profile_data_root() -> Option<PathBuf> {
pub(super) fn profile_data_dir(profile_data_root: &Path, profile_id: &ProfileId) -> PathBuf {
profile_data_root.join(profile_id.as_str()).join("servo")
}
pub(super) fn transient_profile_data_dir(
profile_id: &ProfileId,
) -> Result<PathBuf, SystemTimeError> {
let timestamp = SystemTime::now().duration_since(UNIX_EPOCH)?.as_nanos();
Ok(env::temp_dir().join("ely-browser-servo-profiles").join(format!(
"{}-{}-{timestamp}",
std::process::id(),
profile_id.as_str()
)))
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(crate) enum ProfileDataMode {
Persistent,
Transient,
}