Skip to main content

process_txt_file

Function process_txt_file 

Source
pub fn process_txt_file<F>(
    storage: &GameStorage,
    txt_file: &Path,
    path_transformer: F,
) -> Result<bool>
where F: FnMut(&str) -> Option<String>,
Expand description

Process a .txt file line by line, allowing transformation of quoted paths.

The path_transformer function receives:

  • value_str: The extracted quoted value from a line
  • line: The full original line

It should return Some(new_line) if the line should be modified, or None to keep the original.

Returns Ok(true) if the file was modified, Ok(false) if not modified. Handles decoding/encoding automatically using Windows-1252.