vfstool_lib 0.9.0

A library for constructing and manipulating virtual file systems in Rust, based on OpenMW's VFS implementation.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// SPDX-License-Identifier: GPL-3.0-only
use crate::{NormalizedPath, paths::normalized_safe_key_bytes};
#[cfg(feature = "zip")]
use std::path::Path;
/// Returns `true` if the path has a ZIP or PK3 extension (case-insensitive).
#[cfg(feature = "zip")]
pub(crate) fn is_zip_or_pk3(path: &Path) -> bool {
    path.extension()
        .and_then(|e| e.to_str())
        .is_some_and(|e| e.eq_ignore_ascii_case("zip") || e.eq_ignore_ascii_case("pk3"))
}

pub(crate) fn normalized_archive_key(raw: &[u8]) -> Option<NormalizedPath> {
    normalized_safe_key_bytes(raw)
}