mirror of
https://github.com/djibux/BoilR.git
synced 2026-09-01 05:53:41 +02:00
Fix Proton installed EGS games not found (#251)
This commit is contained in:
@@ -3,7 +3,7 @@ use super::ManifestItem;
|
|||||||
|
|
||||||
use std::fs::{DirEntry, File};
|
use std::fs::{DirEntry, File};
|
||||||
use std::io::BufReader;
|
use std::io::BufReader;
|
||||||
use std::path::Path;
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
pub(crate) fn get_egs_manifests(
|
pub(crate) fn get_egs_manifests(
|
||||||
settings: &EpicGamesLauncherSettings,
|
settings: &EpicGamesLauncherSettings,
|
||||||
@@ -16,33 +16,11 @@ pub(crate) fn get_egs_manifests(
|
|||||||
|
|
||||||
match manifest_dir_result {
|
match manifest_dir_result {
|
||||||
Ok(manifest_dir) => {
|
Ok(manifest_dir) => {
|
||||||
let mut all_manifests = manifest_dir
|
let mut manifests: Vec<ManifestItem> = manifest_dir
|
||||||
.filter_map(|dir| dir.ok())
|
.filter_map(|dir| dir.ok())
|
||||||
.filter_map(get_manifest_item);
|
.filter_map(|dir| {
|
||||||
#[cfg(target_family = "unix")]
|
get_manifest_item(dir, locations.compat_folder_path.clone())
|
||||||
{
|
})
|
||||||
for mut manifest in &mut all_manifests {
|
|
||||||
if let Some(compat_folder) = locations.compat_folder_path.as_ref() {
|
|
||||||
//Strip off the c:\\
|
|
||||||
manifest.manifest_location = compat_folder
|
|
||||||
.join("pfx")
|
|
||||||
.join("drive_c")
|
|
||||||
.join(&manifest.manifest_location[3..].replace('\\', "/"))
|
|
||||||
.to_path_buf()
|
|
||||||
.to_string_lossy()
|
|
||||||
.to_string();
|
|
||||||
|
|
||||||
manifest.install_location = compat_folder
|
|
||||||
.join("pfx")
|
|
||||||
.join("drive_c")
|
|
||||||
.join(&manifest.install_location[3..].replace('\\', "/"))
|
|
||||||
.to_path_buf()
|
|
||||||
.to_string_lossy()
|
|
||||||
.to_string();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let mut manifests: Vec<ManifestItem> = all_manifests
|
|
||||||
.filter(is_game_installed)
|
.filter(is_game_installed)
|
||||||
.filter(is_game_launchable)
|
.filter(is_game_launchable)
|
||||||
.collect();
|
.collect();
|
||||||
@@ -79,12 +57,40 @@ fn is_game_launchable(manifest: &ManifestItem) -> bool {
|
|||||||
(!manifest.launch_executable.is_empty()) || (manifest.is_managed)
|
(!manifest.launch_executable.is_empty()) || (manifest.is_managed)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_manifest_item(dir_entry: DirEntry) -> Option<ManifestItem> {
|
fn get_manifest_item(dir_entry: DirEntry, _path: Option<PathBuf>) -> Option<ManifestItem> {
|
||||||
if let Some(extension) = dir_entry.path().extension() {
|
if let Some(extension) = dir_entry.path().extension() {
|
||||||
if extension.eq("item") {
|
if extension.eq("item") {
|
||||||
if let Ok(file) = File::open(dir_entry.path()) {
|
if let Ok(file) = File::open(dir_entry.path()) {
|
||||||
let reader = BufReader::new(file);
|
let reader = BufReader::new(file);
|
||||||
return serde_json::from_reader(reader).ok();
|
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
|
{
|
||||||
|
if let Ok(mut item) = serde_json::from_reader::<_, ManifestItem>(reader) {
|
||||||
|
if let Some(compat_folder) = _path {
|
||||||
|
//Strip off the c:\\
|
||||||
|
item.manifest_location = compat_folder
|
||||||
|
.join("pfx")
|
||||||
|
.join("drive_c")
|
||||||
|
.join(&item.manifest_location[3..].replace('\\', "/"))
|
||||||
|
.to_path_buf()
|
||||||
|
.to_string_lossy()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
item.install_location = compat_folder
|
||||||
|
.join("pfx")
|
||||||
|
.join("drive_c")
|
||||||
|
.join(&item.install_location[3..].replace('\\', "/"))
|
||||||
|
.to_path_buf()
|
||||||
|
.to_string_lossy()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
return Some(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_family = "unix"))]
|
||||||
|
return serde_json::from_reader::<_, ManifestItem>(reader).ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user