Skip to content

Commit

Permalink
Improve comments around file_name and toktx
Browse files Browse the repository at this point in the history
  • Loading branch information
LPGhatguy committed Mar 24, 2023
1 parent 05d2129 commit 7a1ef6c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ fn toktx(
texture_type: TextureType,
supercompress: bool,
) -> anyhow::Result<Vec<u8>> {
// Create a temporary file to put our image data into. Once `toktx` supports
// stdin inputs, we can remove this code.
let dir = tempfile::tempdir()?;
let input_path = dir.path().join("input");
fs_err::write(&input_path, input_bytes).context("failed to write to temporary file")?;
Expand Down Expand Up @@ -513,7 +515,8 @@ fn cache_dir() -> PathBuf {
path
}

// Create a temporary file. There's probably a better way to do this.
// Generates a temporary file name suitable for writing a KTX2 file generated
// from the given inputs.
fn file_name(format: TextureFormat, supercompress: bool, file_bytes: &[u8]) -> PathBuf {
let mut hasher = seahash::SeaHasher::new();
hasher.write_u8(format as _);
Expand Down

0 comments on commit 7a1ef6c

Please sign in to comment.