Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

rust absolute path

use std::fs;
use std::path::PathBuf;

fn main() {
    let srcdir = PathBuf::from("./src");
    println!("{:?}", fs::canonicalize(&srcdir));

    let solardir = PathBuf::from("./../solarized/.");
    println!("{:?}", fs::canonicalize(&solardir));
}

// possible result
Ok("/Users/name/Developer/so-example/src")
Ok("/Users/name/Developer/solarized")
 
PREVIOUS NEXT
Tagged: #rust #absolute #path
ADD COMMENT
Topic
Name
2+1 =