@@ -129,15 +129,15 @@ struct SteamLibraryFolder {
129129 //totalsize: u64,
130130 //update_clean_bytes_tally: u64,
131131 //time_last_update_verified: u64,
132- #[ serde( alias = "apps" ) ]
133- apps : SteamLibraryFolderApps
132+ // #[serde(alias = "apps")]
133+ // apps: SteamLibraryFolderApps
134134}
135135
136- #[ derive( Deserialize , Debug ) ]
137- struct SteamLibraryFolderApps {
138- #[ serde( rename = "4000" ) ]
139- gmod : Option < u64 >
140- }
136+ // #[derive(Deserialize, Debug)]
137+ // struct SteamLibraryFolderApps {
138+ // #[serde(rename = "4000")]
139+ // gmod: Option<u64>
140+ // }
141141
142142//
143143// SteamLibrary/appmanifest_4000.acf
@@ -942,35 +942,36 @@ where
942942 return Err ( AlmightyError :: Generic ( format ! ( "Couldn't parse Steam libraryfolders.vdf. Is the file corrupt?\n \t {error}" ) ) ) ;
943943 }
944944
945- // Get GMod Steam ibrary
945+ // Get GMod Steam Library and Manifest
946946 let mut gmod_steam_library_path = None ;
947+ let mut gmod_manifest_str = None ;
948+
947949 let steam_libraryfolders: HashMap < & str , SteamLibraryFolder > = steam_libraryfolders. unwrap ( ) ;
948950 for ( _, steam_library) in steam_libraryfolders {
949- if steam_library. apps . gmod . is_some ( ) {
950- gmod_steam_library_path = string_to_canonical_pathbuf ( steam_library. path ) ;
951- }
952- }
953-
954- if gmod_steam_library_path. is_none ( ) {
955- return Err ( AlmightyError :: Generic ( "Couldn't find Garry's Mod app registration. Is Garry's Mod installed?" . to_string ( ) ) ) ;
956- }
957-
958- let gmod_steam_library_path = gmod_steam_library_path. unwrap ( ) ;
959- let gmod_steam_library_path_str = gmod_steam_library_path. to_string_lossy ( ) ;
960-
961- terminal_write ( writer, format ! ( "GMod Steam Library: {gmod_steam_library_path_str}\n " ) . as_str ( ) , true , None ) ;
962-
963- // Get GMod manifest
964- let mut gmod_manifest_path = extend_pathbuf_and_return ( gmod_steam_library_path. to_path_buf ( ) , & [ "steamapps" , "appmanifest_4000.acf" ] ) ;
965- let mut gmod_manifest_str = tokio:: fs:: read_to_string ( gmod_manifest_path) . await ;
951+ // Get potential Steam Library
952+ let new_gmod_steam_library_path = string_to_canonical_pathbuf ( steam_library. path ) ;
953+
954+ if let Some ( new_gmod_steam_library_path) = new_gmod_steam_library_path {
955+ // Get GMod manifest
956+ let mut new_gmod_manifest_path = extend_pathbuf_and_return ( new_gmod_steam_library_path. to_path_buf ( ) , & [ "steamapps" , "appmanifest_4000.acf" ] ) ;
957+ let mut new_gmod_manifest_str = tokio:: fs:: read_to_string ( new_gmod_manifest_path) . await ;
958+
959+ // Try SteamApps with capitalization
960+ if new_gmod_manifest_str. is_err ( ) {
961+ new_gmod_manifest_path = extend_pathbuf_and_return ( new_gmod_steam_library_path. to_path_buf ( ) , & [ "SteamApps" , "appmanifest_4000.acf" ] ) ;
962+ new_gmod_manifest_str = tokio:: fs:: read_to_string ( new_gmod_manifest_path) . await ;
963+ }
966964
967- // Try SteamApps with capitalization
968- if gmod_manifest_str. is_err ( ) {
969- gmod_manifest_path = extend_pathbuf_and_return ( gmod_steam_library_path. to_path_buf ( ) , & [ "SteamApps" , "appmanifest_4000.acf" ] ) ;
970- gmod_manifest_str = tokio:: fs:: read_to_string ( gmod_manifest_path) . await ;
965+ if new_gmod_manifest_str. is_ok ( ) {
966+ gmod_steam_library_path = Some ( new_gmod_steam_library_path) ;
967+ gmod_manifest_str = new_gmod_manifest_str. ok ( ) ;
968+ break ;
969+ }
970+ }
971971 }
972972
973- if gmod_manifest_str. is_err ( ) {
973+ //gmod_steam_library_path.is_none() ||
974+ if gmod_manifest_str. is_none ( ) {
974975 return Err ( AlmightyError :: Generic ( "Couldn't find GMod's appmanifest_4000.acf. Is Garry's Mod installed?" . to_string ( ) ) ) ;
975976 }
976977
@@ -981,9 +982,13 @@ where
981982 return Err ( AlmightyError :: Generic ( format ! ( "Couldn't parse GMod's appmanifest_4000.acf. Is the file corrupt?\n \t {error}" ) ) ) ;
982983 }
983984
984- let gmod_manifest: SteamAppManifest = gmod_manifest. unwrap ( ) ;
985+ let gmod_steam_library_path = gmod_steam_library_path. unwrap ( ) ;
986+ let gmod_steam_library_path_str = gmod_steam_library_path. to_string_lossy ( ) ;
987+
988+ terminal_write ( writer, format ! ( "GMod Steam Library: {gmod_steam_library_path_str}\n " ) . as_str ( ) , true , None ) ;
985989
986990 // Get GMod app state
991+ let gmod_manifest: SteamAppManifest = gmod_manifest. unwrap ( ) ;
987992 let gmod_stateflags = gmod_manifest. state_flags ;
988993 //let gmod_downloadtype = gmod_manifest.download_type; // TODO: Figure this out...
989994 let gmod_scheduledautoupdate = gmod_manifest. scheduled_auto_update ;
0 commit comments