Keep runtime files inside application support
This commit is contained in:
11
src/agent.rs
11
src/agent.rs
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user