Added Chrome Job Profiling and Handling
This commit is contained in:
parent
5b99621044
commit
e4e454960e
5 changed files with 90 additions and 40 deletions
|
|
@ -4,6 +4,7 @@ use crate::state::{SharedState, ChromiumPhase};
|
|||
|
||||
mod download;
|
||||
pub mod utils;
|
||||
pub mod profiles;
|
||||
|
||||
pub const CACHE_DIR: &str = "runtime/chrome-cache";
|
||||
|
||||
|
|
|
|||
21
Core/chromium/profiles.rs
Normal file
21
Core/chromium/profiles.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
use std::{fs, io, path::{Path, PathBuf}};
|
||||
|
||||
pub fn job_profiles_root(exe_dir: &Path) -> PathBuf {
|
||||
exe_dir.join("runtime").join("chrome-profiles")
|
||||
}
|
||||
|
||||
pub fn create_job_profile(exe_dir: &Path, job_id: &str) -> io::Result<PathBuf> {
|
||||
let root = job_profiles_root(exe_dir);
|
||||
fs::create_dir_all(&root)?;
|
||||
let p = root.join(format!("job-{}", job_id));
|
||||
fs::create_dir_all(&p)?;
|
||||
Ok(p)
|
||||
}
|
||||
|
||||
/// Baut die Job-spezifischen Chrome-Args: Basis + user-data-dir + auto RDP-Port
|
||||
pub fn build_job_args(base: &[String], profile_dir: &Path) -> Vec<String> {
|
||||
let mut args = base.to_vec();
|
||||
args.push(format!("--user-data-dir={}", profile_dir.display()));
|
||||
args.push("--remote-debugging-port=0".to_string());
|
||||
args
|
||||
}
|
||||
|
|
@ -39,4 +39,4 @@ fn sanitize_path(name: &str) -> PathBuf {
|
|||
}
|
||||
}
|
||||
clean
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue