Compare commits

...

2 Commits

Author SHA1 Message Date
Julian 4bec7d8198
0.2.1 2023-02-03 14:02:22 -05:00
Julian 9abd399115
Use root folder name from zip 2023-02-03 14:01:57 -05:00
3 changed files with 28 additions and 11 deletions

2
Cargo.lock generated
View File

@ -491,7 +491,7 @@ dependencies = [
[[package]]
name = "geezshade"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"anyhow",
"copypasta",

View File

@ -2,7 +2,7 @@
name = "geezshade"
description = "Automated ReShade setup for FFXIV with GShade presets"
authors = ["NotNite <hi@notnite.com>"]
version = "0.2.0"
version = "0.2.1"
edition = "2021"
[dependencies]

View File

@ -65,18 +65,35 @@ fn get_gshade_presets(xiv_install: PathBuf, config: GeezShadeConfig) -> anyhow::
let shaders_zip = zip::ZipArchive::new(Cursor::new(gshade_shaders))?;
let presets_zip = zip::ZipArchive::new(Cursor::new(gshade_presets))?;
let shaders_folders = vec![
"GShade-master/Textures",
"GShade-master/Shaders",
"GShade-master/ComputeShaders",
];
let presets_folders = vec!["GShade-Presets-master/FFXIV"];
let shaders_folder_name = shaders_zip
.file_names()
.next()
.unwrap()
.split('/')
.next()
.unwrap()
.to_string();
let presets_folder_name = presets_zip
.file_names()
.next()
.unwrap()
.split('/')
.next()
.unwrap()
.to_string();
let shaders_folders = vec!["Textures", "Shaders", "ComputeShaders"]
.iter()
.map(|x| format!("{}/{}", shaders_folder_name, x))
.collect::<Vec<String>>();
let presets_folders = vec![format!("{}/FFXIV", presets_folder_name)];
let dir = xiv_install.join("reshade-shaders");
println!("extracting presets");
extract(dir.clone(), shaders_zip, shaders_folders.clone())?;
extract(dir, presets_zip, presets_folders.clone())?;
extract(dir.clone(), shaders_zip, shaders_folders)?;
extract(dir, presets_zip, presets_folders)?;
Ok(())
}
@ -84,7 +101,7 @@ fn get_gshade_presets(xiv_install: PathBuf, config: GeezShadeConfig) -> anyhow::
fn extract(
dir: PathBuf,
presets_zip: ZipArchive<Cursor<Vec<u8>>>,
presets_folders: Vec<&str>,
presets_folders: Vec<String>,
) -> anyhow::Result<()> {
for filename in presets_zip.file_names() {
for folder in &presets_folders {