fix windows formatting

This commit is contained in:
Piotr Siuszko 2022-09-26 18:32:25 +02:00
parent eb79e560dc
commit 365c724252
3 changed files with 30 additions and 22 deletions

View File

@ -12,7 +12,7 @@ pub struct Configuration {
impl Configuration { impl Configuration {
pub fn rebuild(&mut self) { pub fn rebuild(&mut self) {
let paths = self.get_unity_paths(); let paths = self.get_unity_paths();
println!("{}",paths.len()); println!("{}", paths.len());
self.editors_configurations = paths self.editors_configurations = paths
.into_iter() .into_iter()
.parallel_map(|path| UnityEditor::new(&path)) .parallel_map(|path| UnityEditor::new(&path))
@ -36,7 +36,11 @@ impl Configuration {
#[cfg(unix)] #[cfg(unix)]
let uninstall_exists = true; // just check that on windows only let uninstall_exists = true; // just check that on windows only
let unity_exe_exists = entry.path().clone().join(consts::UNITY_EXE_NAME).exists(); let unity_exe_exists = entry.path().clone().join(consts::UNITY_EXE_NAME).exists();
println!("PATH {} {:?}", unity_exe_exists, &entry.path().clone().join(consts::UNITY_EXE_NAME)); println!(
"PATH {} {:?}",
unity_exe_exists,
&entry.path().clone().join(consts::UNITY_EXE_NAME)
);
uninstall_exists && unity_exe_exists uninstall_exists && unity_exe_exists
} }

View File

@ -6,12 +6,12 @@ pub const UNITY_EXE_NAME: &str = "Unity.app/Contents/MacOS/Unity";
pub const UNITY_EXE_NAME: &str = "Unity"; pub const UNITY_EXE_NAME: &str = "Unity";
#[cfg(windows)] #[cfg(windows)]
pub const SLASH : &str = "\\"; pub const SLASH: &str = "\\";
#[cfg(unix)] #[cfg(unix)]
pub const SLASH : &str = "/"; pub const SLASH: &str = "/";
#[cfg(windows)] #[cfg(windows)]
pub const FILE_MANAGER : &str = "explorer"; pub const FILE_MANAGER: &str = "explorer";
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
pub const FILE_MANAGER : &str = "open"; pub const FILE_MANAGER: &str = "open";
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
pub const FILE_MANAGER : &str = "xdg-open"; pub const FILE_MANAGER: &str = "xdg-open";

View File

@ -1,4 +1,3 @@
use std::borrow::Borrow; use std::borrow::Borrow;
use std::collections::HashMap; use std::collections::HashMap;
use std::path::Path; use std::path::Path;
@ -28,7 +27,7 @@ impl UnityEditor {
return None; return None;
} }
let mut version :Option<String> = None; let mut version: Option<String> = None;
#[cfg(windows)] #[cfg(windows)]
{ {
@ -47,9 +46,15 @@ impl UnityEditor {
version = Some(short.to_string()); version = Some(short.to_string());
} }
} }
}} }
}
if version.is_none() { if version.is_none() {
let folder = base_path.to_str().expect("Fail").split(consts::SLASH).last().unwrap(); let folder = base_path
.to_str()
.expect("Fail")
.split(consts::SLASH)
.last()
.unwrap();
version = Some(folder.to_string()); version = Some(folder.to_string());
} }
@ -62,7 +67,6 @@ impl UnityEditor {
base_path: String::from(path), base_path: String::from(path),
platforms: UnityEditor::get_platforms(path), platforms: UnityEditor::get_platforms(path),
}) })
} }
fn get_platforms(unity_folder: &str) -> Vec<String> { fn get_platforms(unity_folder: &str) -> Vec<String> {