From a73e32177ea2fe80cb6078b58c910efbf3a1267b Mon Sep 17 00:00:00 2001 From: Barnaby <22575741+barnabwhy@users.noreply.github.com> Date: Mon, 4 Mar 2024 18:25:03 +0000 Subject: [PATCH] more universal dir.vpk suggestion --- src-tauri/src/main.rs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 3647a83..318b942 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -132,18 +132,9 @@ async fn load_vpk(state: tauri::State<'_, AppState>, vpk_path: String) -> Result } } fmt => { - if !vpk_path.ends_with("_dir.vpk") { - let vpk_path_buf = PathBuf::from(&vpk_path); - let vpk_file_name = vpk_path_buf - .file_name() - .unwrap() - .to_str() - .unwrap() - .to_string(); - if !LANG_STRS.iter().any(|lang| vpk_file_name.starts_with(lang)) { - println!("Tried to open archive file: {}", fmt); - return Err(format!("Tried to open archive file, consider opening \"english{}_dir.vpk\" instead.", &vpk_file_name.as_str()[..(vpk_file_name.len() - 8)])); - } + if vpk_path.ends_with(".vpk") && !vpk_path.ends_with("dir.vpk") { + println!("Tried to open archive file: {}", fmt); + return Err(format!("Tried to open archive file, consider opening the file ending \"dir.vpk\" instead.")); } println!("Unsupported format: {}", fmt); return Err(format!("Unsupported format: {}", fmt).to_string());