-
Notifications
You must be signed in to change notification settings - Fork 40
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
44370e4
commit d9f640b
Showing
10 changed files
with
110 additions
and
50 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use hemtt_bin_error::Error; | ||
|
||
use crate::context::Context; | ||
|
||
pub fn release(ctx: &Context) -> Result<(), Error> { | ||
let output = ctx | ||
.hemtt_folder() | ||
.parent() | ||
.expect("HEMTT creates two folders, so a parent should always exist") | ||
.join(ctx.config().name()) | ||
.with_extension("zip"); | ||
let options = zip::write::FileOptions::default().compression_level(Some(9)); | ||
|
||
let mut zip = zip::ZipWriter::new(std::fs::File::create(&output)?); | ||
for entry in walkdir::WalkDir::new(ctx.hemtt_folder()) { | ||
let Ok(entry) = entry else { | ||
continue; | ||
}; | ||
let path = entry.path(); | ||
if path.is_dir() { | ||
let path = path | ||
.strip_prefix(ctx.hemtt_folder()) | ||
.expect("We are in the HEMTT folder, the prefix should always exist") | ||
.display() | ||
.to_string(); | ||
if path.is_empty() { | ||
continue; | ||
} | ||
zip.add_directory(path, options)?; | ||
continue; | ||
} | ||
let name = path | ||
.strip_prefix(ctx.hemtt_folder()) | ||
.expect("We are in the HEMTT folder, the prefix should always exist"); | ||
zip.start_file(name.display().to_string(), options)?; | ||
std::io::copy(&mut std::fs::File::open(path)?, &mut zip)?; | ||
} | ||
zip.finish()?; | ||
println!("Created release: {output:?}"); | ||
Ok(()) | ||
} |
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ use hemtt_bin_error::Error; | |
|
||
use crate::context::Context; | ||
|
||
pub mod archive; | ||
pub mod pbo; | ||
|
||
mod binarize; | ||
|
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
Oops, something went wrong.