Skip to content

Instantly share code, notes, and snippets.

@ralphtheninja
Created June 7, 2019 22:35
Show Gist options
  • Save ralphtheninja/718bdb4d12856075d8f05e0ddee210c1 to your computer and use it in GitHub Desktop.
Save ralphtheninja/718bdb4d12856075d8f05e0ddee210c1 to your computer and use it in GitHub Desktop.
if !pathNfilename_abs.is_null() {
let path = std::path::Path::new(
std::ffi::CStr::from_ptr(pathNfilename_abs)
.to_str()
.unwrap(),
);
match fs::canonicalize(path) {
Ok(v) => {
return to_cstring(v.to_str().unwrap());
}
Err(e) => return 0 as *mut libc::c_char,
}
} else {
pathNfilename_abs
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment