this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

🧹 Small refactoring and cleaning up

Rouffy 52b378ad d844c4a0

+25 -26
apps/fennec-tricks/src/cli.rs apps/fennec-tricks/src/cli_args.rs
+4 -4
apps/fennec-tricks/src/dll.rs
··· 3 3 use chrono::Utc; 4 4 use regashii::{Key, KeyName, Registry, ValueName}; 5 5 6 - use crate::values::DownloadableEntry; 6 + use crate::values::functionality::DownloadableEntry; 7 7 8 8 pub enum OverrideType { 9 9 Native, ··· 91 91 for file in dll_entry.download_files.clone() { 92 92 Command::new("wine") 93 93 .arg(format!("/tmp/{file}")) 94 - .args(dll_entry.install_args.clone()) 94 + .args(dll_entry.install_args.clone().unwrap_or(Vec::new())) 95 95 .status() 96 96 .unwrap(); 97 97 } ··· 100 100 let pfx_32_path = format!("{wine_prefix}/drive_c/windows/syswow64"); 101 101 let pfx_64_path = format!("{wine_prefix}/drive_c/windows/system32"); 102 102 for tar in dll_entry.download_files.clone() { 103 - for file in dll_entry.install_files_x32.clone() { 103 + for file in dll_entry.install_files_x32.clone().unwrap() { 104 104 extract_tar(&file, &tar, &pfx_32_path); 105 105 } 106 - for file in dll_entry.install_files_x64.clone() { 106 + for file in dll_entry.install_files_x64.clone().unwrap() { 107 107 extract_tar(&file, &tar, &pfx_64_path); 108 108 } 109 109 }
+3 -3
apps/fennec-tricks/src/download.rs apps/fennec-tricks/src/util/download.rs
··· 1 1 use std::{fs::File, io::Write, path::PathBuf}; 2 2 3 - use crate::values::DownloadableEntry; 3 + use crate::values::functionality::DownloadableEntry; 4 4 5 5 pub fn download(entry: &DownloadableEntry) { 6 6 match entry { ··· 11 11 let file_name = dll_entry.download_files.get(i).unwrap(); 12 12 let file_path = PathBuf::from(format!("/tmp/{file_name}")); 13 13 if !file_path.exists() { 14 - dl(url, file_path, file_name); 14 + download_helper(url, file_path, file_name); 15 15 } 16 16 } 17 17 } 18 18 } 19 19 } 20 20 21 - fn dl(url: &String, file_path: PathBuf, file_name: &String) { 21 + fn download_helper(url: &String, file_path: PathBuf, file_name: &String) { 22 22 let mut file = File::create_new(file_path).unwrap(); 23 23 let response = minreq::get(url).with_follow_redirects(true).send().unwrap(); 24 24
+9 -9
apps/fennec-tricks/src/main.rs
··· 1 1 use clap::Parser; 2 2 3 3 use crate::{ 4 - cli::{Commands, DllType, SectionType}, 5 - serialization::Values, 4 + cli_args::{Args, Commands, DllType, SectionType}, 5 + util::download::download, 6 + values::serialization::Values, 6 7 }; 7 8 8 - pub mod cli; 9 + pub mod cli_args; 9 10 pub mod dll; 10 - pub mod download; 11 - pub mod serialization; 11 + pub mod util; 12 12 pub mod values; 13 13 14 14 fn main() { 15 - let args = crate::cli::Args::parse(); 15 + let args = Args::parse(); 16 16 match args.command { 17 17 Commands::InstallDll { name } => { 18 18 println!("Installing {name:?}\n"); 19 19 match name { 20 20 DllType::MVCRedist2022 => { 21 21 let entry = Values::get_downloadable_entry(SectionType::Dll(name)); 22 - download::download(&entry); 22 + download(&entry); 23 23 dll::install(&entry); 24 24 } 25 25 DllType::DXVK => { 26 26 let entry = Values::get_downloadable_entry(SectionType::Dll(name)); 27 - download::download(&entry); 27 + download(&entry); 28 28 dll::install(&entry); 29 29 } 30 30 DllType::VKD3D => { 31 31 let entry = Values::get_downloadable_entry(SectionType::Dll(name)); 32 - download::download(&entry); 32 + download(&entry); 33 33 dll::install(&entry); 34 34 } 35 35 }
+3 -3
apps/fennec-tricks/src/serialization.rs apps/fennec-tricks/src/values/serialization.rs
··· 20 20 pub download_urls: Vec<String>, 21 21 pub download_type: String, 22 22 pub download_files: Vec<String>, 23 - pub install_args: Vec<String>, 24 - pub install_files_x32: Vec<String>, 25 - pub install_files_x64: Vec<String>, 23 + pub install_args: Option<Vec<String>>, 24 + pub install_files_x32: Option<Vec<String>>, 25 + pub install_files_x64: Option<Vec<String>>, 26 26 pub value: Vec<String>, 27 27 } 28 28
+1
apps/fennec-tricks/src/util/mod.rs
··· 1 + pub mod download;
+3 -3
apps/fennec-tricks/src/values.rs apps/fennec-tricks/src/values/functionality.rs
··· 1 1 use crate::{ 2 - cli::SectionType, 3 - serialization::{DllEntry, Values}, 2 + cli_args::SectionType, 3 + values::serialization::{DllEntry, Values}, 4 4 }; 5 5 use std::{fs::File, io::Read, path::PathBuf}; 6 6 7 - use crate::cli::DllType; 7 + use crate::cli_args::DllType; 8 8 9 9 pub enum DownloadableEntry { 10 10 Dll(DllEntry),
+2
apps/fennec-tricks/src/values/mod.rs
··· 1 + pub mod functionality; 2 + pub mod serialization;
-4
apps/fennec-tricks/values.toml
··· 9 9 download_type = "exe" 10 10 download_files = ["vc_redist.x64.exe", "vc_redist.x86.exe"] 11 11 install_args = ["/install ", "/quiet"] 12 - install_files_x32 = [] 13 - install_files_x64 = [] 14 12 value = [ 15 13 "nb/concrt140.dll", 16 14 "nb/mfc140.dll", ··· 47 45 ] 48 46 download_type = "tar" 49 47 download_files = ["dxvk-2.7.tar.gz"] 50 - install_args = [] 51 48 install_files_x32 = [ 52 49 "dxvk-2.7.tar.gz/dxvk-2.7/x32/d3d8.dll", 53 50 "dxvk-2.7.tar.gz/dxvk-2.7/x32/d3d9.dll", ··· 77 74 ] 78 75 download_type = "tar" 79 76 download_files = ["vkd3d-proton-2.14.1.tar.zst"] 80 - install_args = [] 81 77 install_files_x32 = [ 82 78 "vkd3d-proton-2.14.1.tar.zst/vkd3d-proton-2.14.1/x86/d3d12.dll", 83 79 "vkd3d-proton-2.14.1.tar.zst/vkd3d-proton-2.14.1/x86/d3d12core.dll",