diff --git a/Cargo.toml b/Cargo.toml index 56f8566..fe1e96b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,3 +14,11 @@ glob = "0.3.1" adler = "1.0.2" crc32fast = "1.4.2" miniz_oxide = "0.8.0" + +[lib] +name = "rpfixer" +path = "src/lib.rs" + +[[bin]] +name = "rpfixer" +path = "src/main.rs" \ No newline at end of file diff --git a/readme.md b/readme.md index 99955ec..b35dca0 100644 --- a/readme.md +++ b/readme.md @@ -23,7 +23,7 @@ This tool will not overcome any protection to the zip archive itself. See a prog - Then run the `rpfixer` command ## Function library -- The library has one function: `rpfixer::idk::fix`. Use a `Vec` in it. +- The library has one function: `rpfixer::fix`. Use a `Vec` in it. #### Example code ```rust use std::fs; diff --git a/src/idk/mod.rs b/src/lib.rs similarity index 100% rename from src/idk/mod.rs rename to src/lib.rs index 3db930f..8fd0021 100644 --- a/src/idk/mod.rs +++ b/src/lib.rs @@ -1,9 +1,3 @@ -use std::{ - fmt::Debug, - io::{Read, Write}, - usize, -}; -use std::io::Cursor; use adler::Adler32; use crc32fast::Hasher; use miniz_oxide::inflate::core::{ @@ -14,6 +8,12 @@ use miniz_oxide::inflate::core::{ }, DecompressorOxide, }; +use std::io::Cursor; +use std::{ + fmt::Debug, + io::{Read, Write}, + usize, +}; struct Chunk { kind: [u8; 4], diff --git a/src/main.rs b/src/main.rs index 349a3ee..22d916f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,8 @@ -mod idk; +mod lib; use clap::Parser; use glob::glob; -use std::{fs::{metadata}, path::{PathBuf}}; use std::fs::{read, write}; +use std::{fs::metadata, path::PathBuf}; #[derive(Parser, Debug)] #[command(version, about, long_about = None)] @@ -56,9 +56,7 @@ fn main() { match entry { Ok(path) => { // println!("{:?}", path.display()); - filelist.push( - path.display().to_string().parse().unwrap() - ); + filelist.push(path.display().to_string().parse().unwrap()); } Err(e) => { eprintln!("Globbing error... uh oh..."); @@ -76,9 +74,9 @@ fn main() { // } for thatpath in filelist { - println!("Filename: {:?}",thatpath); + println!("Filename: {:?}", thatpath); let frfr = read(thatpath.to_owned()).expect("wtf the path doesnt exist"); let mut fr = idk::fix(frfr); write(thatpath, fr).expect("file could not write btw"); } -} \ No newline at end of file +}