summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-07-26 17:54:22 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-07-29 00:22:39 -0400
commit4d386e9e1c79d557cae6af58e6df85eb470c1e0c (patch)
tree2a5bda6620b2d68ea5f06e4c49c9b9a3ad4c76f2 /src/main.rs
parent1f093c12f84d269cb68370262d68ff6d515aef2e (diff)
Implement CodeCache
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs
index a12f95018..c02d918b1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,11 +1,16 @@
-extern crate libc;
-#[macro_use]
-extern crate log;
extern crate flatbuffers;
+extern crate libc;
extern crate msg_rs as msg_generated;
extern crate sha1;
extern crate tempfile;
extern crate url;
+#[macro_use]
+extern crate log;
+
+mod binding;
+mod deno_dir;
+mod fs;
+pub mod handlers;
use libc::c_int;
use libc::c_void;
@@ -14,10 +19,6 @@ use std::ffi::CStr;
use std::ffi::CString;
use std::mem;
-mod handlers;
-pub use handlers::*;
-mod binding;
-
// Returns args passed to V8, followed by args passed to JS
fn parse_core_args(args: Vec<String>) -> (Vec<String>, Vec<String>) {
let mut rest = vec![];
@@ -89,6 +90,7 @@ type DenoException<'a> = &'a str;
pub struct Deno {
ptr: *const binding::DenoC,
+ dir: deno_dir::DenoDir,
}
static DENO_INIT: std::sync::Once = std::sync::ONCE_INIT;
@@ -101,6 +103,7 @@ impl Deno {
let deno_box = Box::new(Deno {
ptr: 0 as *const binding::DenoC,
+ dir: deno_dir::DenoDir::new(None).unwrap(),
});
let deno: &'a mut Deno = Box::leak(deno_box);
let external_ptr = deno as *mut _ as *const c_void;
@@ -161,6 +164,7 @@ fn test_c_to_rust() {
let d = Deno::new();
let d2 = from_c(d.ptr);
assert!(d.ptr == d2.ptr);
+ assert!(d.dir.root.join("gen") == d.dir.gen, "Sanity check");
}
static LOGGER: Logger = Logger;