Restart steam option (#82)

Adds options to start and stop steam when importing
This commit is contained in:
Philip Kristoffersen
2022-04-15 09:38:43 +02:00
committed by GitHub
parent 9396b06765
commit fcc3a4abc3
9 changed files with 110 additions and 7 deletions
+13 -5
View File
@@ -53,11 +53,7 @@ pub struct SteamUsersInfo {
pub fn get_shortcuts_paths(
settings: &SteamSettings,
) -> Result<Vec<SteamUsersInfo>, Box<dyn Error + Sync + Send>> {
let user_location = settings.location.clone();
let steam_path_str = match user_location {
Some(location) => location,
None => get_default_location()?,
};
let steam_path_str = get_steam_path(settings)?;
let steam_path = Path::new(&steam_path_str);
if !steam_path.exists() {
return Result::Err(Box::new(SteamFolderNotFound {
@@ -107,6 +103,15 @@ pub fn get_shortcuts_paths(
Ok(users_info)
}
pub fn get_steam_path(settings: &SteamSettings) -> Result<String, Box<dyn Error + Sync + Send>> {
let user_location = settings.location.clone();
let steam_path_str = match user_location {
Some(location) => location,
None => get_default_location()?,
};
Ok(steam_path_str)
}
pub fn get_default_location() -> Result<String, Box<dyn Error + Sync + Send>> {
#[cfg(target_os = "windows")]
let path_string = {
@@ -198,3 +203,6 @@ pub fn get_users_images(user: &SteamUsersInfo) -> Result<Vec<String>, Box<dyn Er
.collect();
Ok(file_names)
}