Skip to main content

pacenotes_installer\worker/
install_run.rs

1/// Everything scene 6's run needs, owned, because it crosses a thread. No token
2/// and no package list: everything it installs from is in the cache, and the
3/// conflict report it may send is unauthenticated.
4pub struct InstallJob {
5    pub base_url: String,
6    pub cache_root: std::path::PathBuf,
7    pub game_dir: std::path::PathBuf,
8    pub game: pacenotes_installer::gamedir::Game,
9    /// What the folder holds afterwards, in install order.
10    pub selection: Vec<String>,
11    /// Category to picked key, for the configuration step.
12    pub picks: std::collections::BTreeMap<String, String>,
13    pub choice_categories: Vec<String>,
14    /// Measured by the UI thread, the side that may call Win32.
15    pub facts: pacenotes_installer::engine::HostFacts,
16    pub cancel: std::sync::Arc<std::sync::atomic::AtomicBool>,
17}
18
19/// Scene 6's run: apply the selection to the game folder from the cache, which
20/// is what lets this screen work offline.
21pub fn run_install(job: InstallJob, reporter: &super::Reporter) -> super::Message {
22    let cache = pacenotes_installer::cache::Cache::open(&job.cache_root);
23    match super::apply_selection::apply_selection(&job, &cache, reporter) {
24        Ok(applied) => super::Message::Installed(super::Outcome::Done { applied }),
25        Err(message) => super::Message::Installed(super::Outcome::Failed(message)),
26    }
27}