Add Rojo C API experiment

This commit is contained in:
Lucien Greathouse
2019-11-07 18:20:55 -08:00
parent f1daafbf9e
commit dfb015acc2
6 changed files with 43 additions and 0 deletions

14
clibrojo/src/lib.rs Normal file
View File

@@ -0,0 +1,14 @@
use std::{ffi::CStr, os::raw::c_char, path::PathBuf};
use librojo::commands::{serve, ServeOptions};
#[no_mangle]
pub extern "C" fn rojo_serve(path: *const c_char) {
let path = unsafe { PathBuf::from(CStr::from_ptr(path).to_str().unwrap()) };
serve(&ServeOptions {
fuzzy_project_path: path,
port: None,
})
.unwrap();
}