Sha256: b3bd03acbe860ba481e7bde90072d8d830c60d6fa6a6e85c791ab766f4fa22b4

Contents?: true

Size: 331 Bytes

Versions: 2

Compression:

Stored size: 331 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 {
    assert!(!string.is_null());

    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

2 entries across 2 versions & 1 rubygems

Version Path
faster_path-0.1.7 src/is_directory.rs
faster_path-0.1.6 src/is_directory.rs