unity_hub/unity/hub/
mod.rs1pub mod editors;
2pub mod paths;
3pub mod module;
4
5use std::io;
6use log::debug;
7use crate::unity;
8use thiserror::Error;
9use crate::error::UnityHubError;
10use crate::unity::Installations;
11type Result<T> = std::result::Result<T, UnityHubError>;
14
15pub fn list_installations() -> Result<Installations> {
16 let install_path = paths::install_path()
17 .ok_or_else(|| UnityHubError::InstallPathNotFound)?;
18
19 debug!("api hub install path: {}", install_path.display());
20
21 let editors = editors::Editors::load()?;
22 debug!("raw editors map: {:?}", editors);
23 let editors = crate::unity::Installations::from(editors);
24 if let Ok(installations) = unity::list_installations_in_dir(&install_path) {
25 let iter = installations.chain(editors);
26 return Ok(unity::Installations(Box::new(iter)));
27 }
28
29 Ok(editors)
30}