Use root folder name from zip
This commit is contained in:
parent
98dbd192a1
commit
9abd399115
1 changed files with 26 additions and 9 deletions
35
src/main.rs
35
src/main.rs
|
@ -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 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 shaders_folders = vec![
|
let shaders_folder_name = shaders_zip
|
||||||
"GShade-master/Textures",
|
.file_names()
|
||||||
"GShade-master/Shaders",
|
.next()
|
||||||
"GShade-master/ComputeShaders",
|
.unwrap()
|
||||||
];
|
.split('/')
|
||||||
let presets_folders = vec!["GShade-Presets-master/FFXIV"];
|
.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");
|
let dir = xiv_install.join("reshade-shaders");
|
||||||
|
|
||||||
println!("extracting presets");
|
println!("extracting presets");
|
||||||
extract(dir.clone(), shaders_zip, shaders_folders.clone())?;
|
extract(dir.clone(), shaders_zip, shaders_folders)?;
|
||||||
extract(dir, presets_zip, presets_folders.clone())?;
|
extract(dir, presets_zip, presets_folders)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -84,7 +101,7 @@ fn get_gshade_presets(xiv_install: PathBuf, config: GeezShadeConfig) -> anyhow::
|
||||||
fn extract(
|
fn extract(
|
||||||
dir: PathBuf,
|
dir: PathBuf,
|
||||||
presets_zip: ZipArchive<Cursor<Vec<u8>>>,
|
presets_zip: ZipArchive<Cursor<Vec<u8>>>,
|
||||||
presets_folders: Vec<&str>,
|
presets_folders: Vec<String>,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
for filename in presets_zip.file_names() {
|
for filename in presets_zip.file_names() {
|
||||||
for folder in &presets_folders {
|
for folder in &presets_folders {
|
||||||
|
|
Loading…
Reference in a new issue