pub fn safe_open_file(path: &Path, allow_symlinks: bool) -> Result<File>Expand description
Safely opens a file for reading
ยงExamples
use atlas_cli::utils::safe_open_file;
use std::path::Path;
use std::io::Read;
let path = Path::new("example.txt");
match safe_open_file(&path, false) {
Ok(mut file) => {
let mut contents = String::new();
file.read_to_string(&mut contents).unwrap();
println!("File contents: {}", contents);
}
Err(e) => eprintln!("Error opening file: {}", e),
}