rename some variable names to be more accurate

This commit is contained in:
Julian 2023-01-31 19:24:22 -05:00
parent 9f48c384c5
commit 7bf28b2657
Signed by: NotNite
GPG key ID: BD91A5402CCEB08A

View file

@ -7,9 +7,9 @@ use zip::ZipArchive;
const USER_AGENT: &str = "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0"; const USER_AGENT: &str = "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0";
const RESHADE_URL: &str = "https://reshade.me/downloads/ReShade_Setup_5.6.0_Addon.exe"; const RESHADE_URL: &str = "https://reshade.me/downloads/ReShade_Setup_5.6.0_Addon.exe";
const GSHADE_PRESETS_URL: &str = const GSHADE_SHADERS_URL: &str =
"https://github.com/Mortalitas/GShade/archive/refs/heads/master.zip"; "https://github.com/Mortalitas/GShade/archive/refs/heads/master.zip";
const GSHADE_COMMUNITY_PRESETS_URL: &str = const GSHADE_PRESETS_URL: &str =
"https://github.com/Mortalitas/GShade-Presets/archive/refs/heads/master.zip"; "https://github.com/Mortalitas/GShade-Presets/archive/refs/heads/master.zip";
fn get_file(path: &str) -> anyhow::Result<Vec<u8>> { fn get_file(path: &str) -> anyhow::Result<Vec<u8>> {
@ -39,29 +39,25 @@ fn get_reshade(xiv_install: PathBuf) -> anyhow::Result<()> {
fn get_gshade_presets(xiv_install: PathBuf) -> anyhow::Result<()> { fn get_gshade_presets(xiv_install: PathBuf) -> anyhow::Result<()> {
println!("fetching presets"); println!("fetching presets");
let gshade_shaders = get_file(GSHADE_SHADERS_URL)?;
let gshade_presets = get_file(GSHADE_PRESETS_URL)?; let gshade_presets = get_file(GSHADE_PRESETS_URL)?;
let gshade_community_presets = get_file(GSHADE_COMMUNITY_PRESETS_URL)?;
println!("opening presets"); println!("opening presets");
let shaders_zip = zip::ZipArchive::new(Cursor::new(gshade_shaders))?;
let presets_zip = zip::ZipArchive::new(Cursor::new(gshade_presets))?; let presets_zip = zip::ZipArchive::new(Cursor::new(gshade_presets))?;
let community_presets_zip = zip::ZipArchive::new(Cursor::new(gshade_community_presets))?;
let presets_folders = vec![ let shaders_folders = vec![
"GShade-master/Textures", "GShade-master/Textures",
"GShade-master/Shaders", "GShade-master/Shaders",
"GShade-master/ComputeShaders", "GShade-master/ComputeShaders",
]; ];
let community_presets_folders = vec!["GShade-Presets-master/FFXIV"]; let presets_folders = vec!["GShade-Presets-master/FFXIV"];
let dir = xiv_install.join("reshade-shaders"); let dir = xiv_install.join("reshade-shaders");
println!("extracting presets"); println!("extracting presets");
extract(dir.clone(), presets_zip, presets_folders.clone())?; extract(dir.clone(), shaders_zip, shaders_folders.clone())?;
extract( extract(dir, presets_zip, presets_folders.clone())?;
dir,
community_presets_zip,
community_presets_folders.clone(),
)?;
Ok(()) Ok(())
} }
@ -160,8 +156,12 @@ SavePath=.\reshade-screenshots
"# "#
.trim(); .trim();
println!("writing config"); if !xiv_install.join("ReShade.ini").exists() {
std::fs::write(xiv_install.join("ReShade.ini"), config)?; println!("writing config");
std::fs::write(xiv_install.join("ReShade.ini"), config)?;
} else {
println!("config already exists");
}
Ok(()) Ok(())
} }