safe_file_path

Function safe_file_path 

Source
pub fn safe_file_path(path: &Path, allow_symlinks: bool) -> Result<PathBuf>
Expand description

Ensures a file path is safe to use (not a symlink or hard link unless allowed)

ยงExamples

use atlas_cli::utils::safe_file_path;
use std::path::Path;

let path = Path::new("/tmp/safe_file.txt");

// Check path without allowing symlinks
match safe_file_path(&path, false) {
    Ok(safe_path) => println!("Path is safe: {:?}", safe_path),
    Err(e) => println!("Path is not safe: {}", e),
}

// Allow symlinks
let _ = safe_file_path(&path, true);