Module cpp_to_rust_common::file_utils [] [src]

Various utilities for working with files

Structs

FileWrapper

A wrapper over std::fs::File containing ths file's path.

ReadDirWrapper

A wrapper over std::fs::DirEntry iterator with better error reporting

Traits

PathBufWithAdded

Adds with_added function for paths.

Functions

canonicalize

Canonicalize path. Similar to std::fs::canonicalize, but \\?\ prefix is removed. Windows implementation of std::fs::canonicalize adds this prefix, but many tools don't process it correctly, including CMake and compilers.

copy_file

A wrapper over std::fs::copy with better error reporting

copy_recursively

Copy file or directory src to dst recursively

create_dir

A wrapper over std::fs::create_dir with better error reporting

create_dir_all

A wrapper over std::fs::create_dir_all with better error reporting

create_file

A wrapper over std::fs::File::create with better error reporting.

file_to_string

Returns content of the file path as a string.

load_bincode

Deserialize value from binary file path.

load_json

Deserialize value from JSON file path.

load_toml

Load data from a TOML file

move_files

Move file or directory src to dst recursively, overwriting previous contents of dst. If corresponding old file has the same content as the new file, timestamps of the old file are preserved.

open_file

A wrapper over std::fs::File::open with better error reporting.

open_file_with_options

A wrapper over std::fs::OpenOptions::open with better error reporting.

os_str_to_str

A wrapper over OsStr::to_str with better error reporting

os_string_into_string

A wrapper over OsString::into_string with better error reporting

path_to_str

A wrapper over Path::to_str with better error reporting

read_dir

A wrapper over std::fs::read_dir with better error reporting

remove_dir

A wrapper over std::fs::remove_dir with better error reporting

remove_dir_all

A wrapper over std::fs::remove_dir_all with better error reporting

remove_file

A wrapper over std::fs::remove_file with better error reporting

rename_file

A wrapper over std::fs::rename with better error reporting

repo_crate_local_path

Returns current absolute path of relative_path. relative_path is relative to the repository root.

save_bincode

Serialize value into binary file path.

save_json

Serialize value into JSON file path.

save_toml

Save data to a TOML file