Sha256: f3b6c0d06c83b39581f1bd4565cac2498f3315ae4aad5e1316d7f197c603bf8c

Contents?: true

Size: 342 Bytes

Versions: 4

Compression:

Stored size: 342 Bytes

Contents

use std::path::MAIN_SEPARATOR;
use libc::c_char;
use std::ffi::{CStr};

#[no_mangle]
pub extern fn is_relative(path: *const c_char) -> bool {
  if path.is_null() {
    return false;
  }
  let r_str = unsafe { CStr::from_ptr(path) }.to_str().unwrap();

  match r_str.chars().next() {
    Some(c) => c != MAIN_SEPARATOR,
    None => true
  }
}

Version data entries

4 entries across 4 versions & 1 rubygems

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