Sha256: 2ac8dc2cf5ea25ca54fcf336732437ea67140d835ca9c57c17b78635e92070d1
Contents?: true
Size: 590 Bytes
Versions: 3
Compression:
Stored size: 590 Bytes
Contents
#[no_mangle] pub extern fn dirname_for_chop(string: *const c_char) -> *const c_char { let c_str = unsafe { assert!(!string.is_null()); CStr::from_ptr(string) }; let r_str = str::from_utf8(c_str.to_bytes()).unwrap(); if r_str.is_empty() { return string } let path = Path::new(r_str).parent().unwrap_or(Path::new("")); let out_str = if !path.to_str().unwrap().is_empty() { format!("{}{}", path.to_str().unwrap(), MAIN_SEPARATOR) } else { format!("{}", path.to_str().unwrap()) }; let output = CString::new(out_str).unwrap(); output.into_raw() }
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
faster_path-0.1.3 | src/dirname_for_chop.rs |
faster_path-0.1.2 | src/dirname_for_chop.rs |
faster_path-0.1.1 | src/dirname_for_chop.rs |