check if symlink exists in rust

main.rs
use std::fs;

fn main() {
    let symlink_path = "path/to/symlink";

    if fs::metadata(symlink_path).is_ok() {
        println!("Symlink exists.");
    } else {
        println!("Symlink does not exist.");
    }
}
216 chars
12 lines

related categories

gistlibby LogSnag