rename some variable names to be more accurate
This commit is contained in:
parent
9f48c384c5
commit
7bf28b2657
1 changed files with 14 additions and 14 deletions
28
src/main.rs
28
src/main.rs
|
@ -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 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";
|
||||
const GSHADE_COMMUNITY_PRESETS_URL: &str =
|
||||
const GSHADE_PRESETS_URL: &str =
|
||||
"https://github.com/Mortalitas/GShade-Presets/archive/refs/heads/master.zip";
|
||||
|
||||
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<()> {
|
||||
println!("fetching presets");
|
||||
let gshade_shaders = get_file(GSHADE_SHADERS_URL)?;
|
||||
let gshade_presets = get_file(GSHADE_PRESETS_URL)?;
|
||||
let gshade_community_presets = get_file(GSHADE_COMMUNITY_PRESETS_URL)?;
|
||||
|
||||
println!("opening presets");
|
||||
let shaders_zip = zip::ZipArchive::new(Cursor::new(gshade_shaders))?;
|
||||
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/Shaders",
|
||||
"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");
|
||||
|
||||
println!("extracting presets");
|
||||
extract(dir.clone(), presets_zip, presets_folders.clone())?;
|
||||
extract(
|
||||
dir,
|
||||
community_presets_zip,
|
||||
community_presets_folders.clone(),
|
||||
)?;
|
||||
extract(dir.clone(), shaders_zip, shaders_folders.clone())?;
|
||||
extract(dir, presets_zip, presets_folders.clone())?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -160,8 +156,12 @@ SavePath=.\reshade-screenshots
|
|||
"#
|
||||
.trim();
|
||||
|
||||
println!("writing config");
|
||||
std::fs::write(xiv_install.join("ReShade.ini"), config)?;
|
||||
if !xiv_install.join("ReShade.ini").exists() {
|
||||
println!("writing config");
|
||||
std::fs::write(xiv_install.join("ReShade.ini"), config)?;
|
||||
} else {
|
||||
println!("config already exists");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue