Expand description
Generic utility functions for the crate.
This module contains miscellaneous utility functions that don’t fit into more specific modules. Functions are organized into categories:
- Generic utils: String parsing, case-insensitive operations, line/column calculations
- Path utils: File and folder enumeration, path sanitization, absolute path conversion
- Time utils: File modification time queries, current time helpers
- Pelite utils: PE (Windows executable) file inspection
- VWise utils: WWise audio hash generation
- Filename sanitization: Windows-compatible filename cleaning
- Decoder utils: Size mismatch validation for binary decoders
Constants§
- DEFAULT_
FILENAME - Default filename used when sanitization results in an empty name.
- INVALID_
CHARACTERS_ WINDOWS - Windows-invalid filename characters.
Functions§
- closest_
valid_ char_ byte - Finds the closest valid UTF-8 character boundary at or after the given byte position.
- current_
time - Returns the current Unix timestamp in seconds.
- files_
from_ subdir - Returns all files in a directory, optionally scanning subdirectories recursively.
- files_
in_ folder_ from_ newest_ to_ oldest - Returns all files in a directory sorted by modification time (newest first).
- final_
folders_ from_ subdir - Returns all leaf directories (folders with no subfolders) in a directory tree.
- hash_
vwise - Generates a WWise audio hash from a filename.
- last_
modified_ time_ from_ file - Returns the last modification time of a file as a Unix timestamp.
- last_
modified_ time_ from_ files - Returns the most recent modification time from a list of file paths.
- line_
column_ from_ string_ pos - Converts a byte position in a string to a line and column number.
- oldest_
file_ in_ folder - Returns the oldest file in a directory based on modification time.
- parse_
str_ as_ bool - Parses a string to a boolean value.
- path_
to_ absolute_ path - Converts a path to an absolute
PathBuf, optionally stripping Windows UNC prefix. - path_
to_ absolute_ string - Converts a path to an absolute path string, stripping Windows UNC prefix if present.
- sanitize_
filename - Sanitizes a filename by replacing invalid Windows characters.
- sanitize_
path - Sanitizes a file path by cleaning the filename component.
- starts_
with_ case_ insensitive - Checks if a string starts with another string (case-insensitive).