Sha256: a86a036f8e3768f4bacc7daf729c5d1328f0519bd519570b58eef003cebb71e7

Contents?: true

Size: 350 Bytes

Versions: 5

Compression:

Stored size: 350 Bytes

Contents

use libc::c_char;
use std::ffi::{CStr};
use std::str;
use std::path::Path;

#[no_mangle]
pub extern fn is_directory(string: *const c_char) -> bool {
  let c_str = unsafe {
    if string.is_null() {
      return false;
    }
    CStr::from_ptr(string)
  };

  let r_str = str::from_utf8(c_str.to_bytes()).unwrap_or("");

  Path::new(r_str).is_dir()
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
faster_path-0.1.13 src/is_directory.rs
faster_path-0.1.12 src/is_directory.rs
faster_path-0.1.11 src/is_directory.rs
faster_path-0.1.10 src/is_directory.rs
faster_path-0.1.8 src/is_directory.rs