Keep private sidecar profile data transient
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user