From 72ddd7b7704f2087a52c9c0552446682918c513b Mon Sep 17 00:00:00 2001 From: Filip Wandzio Date: Thu, 22 Jan 2026 23:14:08 +0100 Subject: Implement basic game files download logic Implement core clap arguments Respect XDG_BASE_DIR Currently library extraction is broken because it assumes every instace has it's own library folder. This should be refactored so instances share libraries Signed-off-by: Filip Wandzio --- src/util/sha1.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/util/sha1.rs (limited to 'src/util/sha1.rs') diff --git a/src/util/sha1.rs b/src/util/sha1.rs new file mode 100644 index 0000000..c5f1021 --- /dev/null +++ b/src/util/sha1.rs @@ -0,0 +1,14 @@ +#![allow(dead_code)] + +use std::path::Path; + +use sha1::{Digest, Sha1}; + +use crate::errors::McError; + +pub async fn sha1_hex(path: &Path) -> Result { + let data = tokio::fs::read(path).await?; + let mut hasher = Sha1::new(); + hasher.update(&data); + Ok(format!("{:x}", hasher.finalize())) +} -- cgit v1.2.3