Expand description
The hf crate is a cross-platform library for manipulating hidden files or
hidden directories.
§Examples
§On Unix
use std::fs::File;
let temp_dir = tempfile::tempdir().unwrap();
let temp_dir = temp_dir.path();
let file_path = temp_dir.join("file");
let hidden_file_path = temp_dir.join(".file");
File::create(&file_path).unwrap();
assert!(file_path.exists());
assert!(!hidden_file_path.exists());
hf::hide(&file_path).unwrap();
assert!(!file_path.exists());
assert!(hidden_file_path.exists());
hf::show(&hidden_file_path).unwrap();
assert!(file_path.exists());
assert!(!hidden_file_path.exists());§On Windows
use std::fs::File;
let temp_dir = tempfile::tempdir().unwrap();
let file_path = temp_dir.path().join("file");
File::create(&file_path).unwrap();
assert!(!hf::is_hidden(&file_path).unwrap());
hf::hide(&file_path).unwrap();
assert!(hf::is_hidden(&file_path).unwrap());
hf::show(&file_path).unwrap();
assert!(!hf::is_hidden(file_path).unwrap());Functions§
- Hides a file or a directory.
- Returns
trueif the path is a hidden file or a hidden directory. - Shows a hidden file or a hidden directory.