uwu
This commit is contained in:
parent
36eb675091
commit
170604b463
|
@ -38,17 +38,19 @@ pub fn main() {
|
|||
temp.seek(SeekFrom::Start(0)).unwrap();
|
||||
let hash = sha.finalize_reset();
|
||||
let hash = hex::encode(&*hash);
|
||||
if !hashes.contains_key(&hash) {
|
||||
let new = !hashes.contains_key(&hash);
|
||||
let saved = SavedFile {
|
||||
author: extractor.manifest().author.clone(),
|
||||
package: extractor.manifest().name.clone(),
|
||||
package_version: extractor.manifest().version.clone(),
|
||||
game_path: file.file.full_path.clone(),
|
||||
group: file.group.map(ToOwned::to_owned),
|
||||
option: file.option.map(ToOwned::to_owned),
|
||||
};
|
||||
hashes.entry(hash.clone()).or_default().push(saved);
|
||||
|
||||
if new {
|
||||
let path = Path::new("files").join(&hash);
|
||||
let saved = SavedFile {
|
||||
author: extractor.manifest().author.clone(),
|
||||
package: extractor.manifest().name.clone(),
|
||||
package_version: extractor.manifest().version.clone(),
|
||||
game_path: file.file.full_path.clone(),
|
||||
group: file.group.map(ToOwned::to_owned),
|
||||
option: file.option.map(ToOwned::to_owned),
|
||||
};
|
||||
hashes.entry(hash).or_default().push(saved);
|
||||
std::io::copy(&mut temp, &mut File::create(&path).unwrap()).unwrap();
|
||||
// std::fs::write(&path, data).unwrap();
|
||||
println!("writing {}", path.to_string_lossy());
|
||||
|
|
Loading…
Reference in New Issue