1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use crate::error::CobbleResult;
use crate::instance::Instance;
use crate::minecraft::install::{install_assets, install_resources};
use crate::minecraft::installation_update::InstallationUpdate;
use crossbeam_channel::Sender;
use std::sync::atomic::AtomicBool;
use std::sync::Arc;
impl Instance {
pub fn install_assets(
&self,
update_sender: Sender<InstallationUpdate>,
cancel: Arc<AtomicBool>,
) -> CobbleResult<bool> {
let asset_index = self.read_asset_index()?;
match asset_index.map_to_resources {
true => install_resources(
&asset_index,
self.resources_path(),
self.dot_minecraft_path(),
update_sender,
cancel,
),
false => install_assets(&asset_index, self.assets_path(), update_sender, cancel),
}
}
}