1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
extern crate libc;

use std::ffi::CString;

mod ffi;

#[allow(dead_code)]
pub fn unzip(zip_path: &str, target_path: &str) -> i32 {
    let src = CString::new(zip_path).expect(format!("CString::new(\"{}\") failed", zip_path).as_str());
    let dst = CString::new(target_path).expect(format!("CString::new(\"{}\") failed", target_path).as_str());
    unsafe {
        ffi::unzip(src.as_ptr(), dst.as_ptr())
    }
}