Skip to main content

Module util

Module util 

Source
Expand description

General utilities for file I/O, path handling, and data serialisation.

Functions§

copy_to_staging
Copy a file from the input tree into the staging directory, preserving its relative path.
normalize_id
Convert a directory/file name into a safe alphanumeric ID for use as a pack identifier. E.g. “Stranded II” → “stranded_ii”, “MyMod-v1!” → “mymod_v1”.
parse_inf_file
Parse an .inf file, handling non-UTF-8 encodings gracefully.
read_file_lossy
Read a file to String, trying UTF-8 first, falling back to Latin-1 (ISO-8859-1) which maps bytes 128-255 directly to Unicode codepoints U+0080–U+00FF.
relative_path
Compute the relative path of a file within the input tree.
write_ron
Serialize data to RON and write to path.