Keep runtime files inside application support

This commit is contained in:
Georg Bauer
2026-07-28 18:34:08 +02:00
parent 31f6426eef
commit 9cf1c70a67
8 changed files with 141 additions and 108 deletions

View File

@@ -32,7 +32,7 @@ pub(crate) const COMPACTION_OBSERVATION_PREFIX: &str = "Bash job update after co
#[repr(C)]
struct WebConfig {
home_dir: *const c_char,
profile_dir: *const c_char,
port: c_int,
confirm: Option<unsafe extern "C" fn(*mut c_void, *const c_char, *mut c_char, usize) -> c_int>,
confirm_data: *mut c_void,
@@ -77,16 +77,15 @@ impl Browser {
let mut callbacks = Box::new(WebCallbacks {
cancel: AtomicPtr::new(std::ptr::null_mut()),
});
let home = CString::new(
std::env::var_os("HOME")
.unwrap_or_else(|| ".".into())
let profile = CString::new(
crate::app::browser_profile_path()
.to_string_lossy()
.as_bytes(),
)
.map_err(|_| "The home directory contains a NUL byte.".to_owned())?;
.map_err(|_| "The browser profile path contains a NUL byte.".to_owned())?;
let data = (&mut *callbacks) as *mut WebCallbacks as *mut c_void;
let config = WebConfig {
home_dir: home.as_ptr(),
profile_dir: profile.as_ptr(),
port: 9333,
confirm: Some(web_confirm),
confirm_data: data,