-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51fc305
commit 3d94f6b
Showing
5 changed files
with
235 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,38 @@ | ||
fn main() { | ||
println!("Hello, world!"); | ||
use std::{error::Error, io, path::PathBuf}; | ||
|
||
use ashen::asset::pack_file::{directory::VirtualFileSystem, PackFile}; | ||
use clap::Parser; | ||
|
||
#[derive(Parser)] | ||
#[command(version, about)] | ||
pub enum Cli { | ||
/// Output packfile contents. | ||
Output { | ||
/// The path of the 'pack'.file | ||
path: PathBuf, | ||
}, | ||
} | ||
|
||
// enum AssetKind { | ||
// Copyright, | ||
// } | ||
|
||
fn main() -> Result<(), Box<dyn Error>> { | ||
let cli = Cli::parse(); | ||
|
||
match cli { | ||
Cli::Output { path } => { | ||
let pack = std::fs::read(path)?; | ||
let (_, pack) = PackFile::new(&pack)?; | ||
|
||
let dir = VirtualFileSystem::from_106_packfile(pack) | ||
.ok_or_else(|| io::Error::from(io::ErrorKind::InvalidInput))?; | ||
|
||
let handle = dir.read("/copyright")?; | ||
|
||
std::fs::write("./output/cli/copyright.txt", handle.bytes())?; | ||
} | ||
} | ||
|
||
Ok(()) | ||
} |