mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-20 11:47:46 +00:00
Add logging crate
This commit is contained in:
parent
f84bd8295d
commit
540341cf57
2 changed files with 9 additions and 0 deletions
|
@ -51,6 +51,8 @@ patch_testing = ["game_install"]
|
|||
# amazing binary parsing/writing library
|
||||
binrw = "0.11.1"
|
||||
|
||||
tracing = "0.1.37"
|
||||
|
||||
# used for zlib compression in sqpack files
|
||||
libz-sys = { version = "1.1", default-features = false }
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ use crate::sqpack::calculate_hash;
|
|||
use std::fs;
|
||||
use std::fs::DirEntry;
|
||||
use std::path::PathBuf;
|
||||
use tracing::{debug, error, info, span, warn, Level};
|
||||
|
||||
/// Framework for operating on game data.
|
||||
pub struct GameData {
|
||||
|
@ -59,6 +60,8 @@ impl GameData {
|
|||
/// GameData::from_existing("$FFXIV/game");
|
||||
/// ```
|
||||
pub fn from_existing(directory: &str) -> Option<GameData> {
|
||||
debug!(directory, "Loading game directory");
|
||||
|
||||
match is_valid(directory) {
|
||||
true => Some(Self {
|
||||
game_directory: String::from(directory),
|
||||
|
@ -94,6 +97,8 @@ impl GameData {
|
|||
.collect();
|
||||
|
||||
for repository_path in repository_paths {
|
||||
debug!(repository_path=repository_path.path().to_str(), "Found repository");
|
||||
|
||||
self.repositories
|
||||
.push(Repository::from_existing(repository_path.path().to_str().unwrap()).unwrap());
|
||||
}
|
||||
|
@ -169,6 +174,8 @@ impl GameData {
|
|||
/// file.write(data.as_slice()).unwrap();
|
||||
/// ```
|
||||
pub fn extract(&self, path: &str) -> Option<MemoryBuffer> {
|
||||
debug!(file=path, "Extracting file");
|
||||
|
||||
let hash = calculate_hash(path);
|
||||
|
||||
let index_file = self.get_index_file(path)?;
|
||||
|
|
Loading…
Add table
Reference in a new issue