mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-21 03:36:06 +00:00
Add Rojo C API experiment
This commit is contained in:
parent
f1daafbf9e
commit
dfb015acc2
6 changed files with 43 additions and 0 deletions
14
clibrojo/src/lib.rs
Normal file
14
clibrojo/src/lib.rs
Normal 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();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue