summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/flags.rs5
-rw-r--r--src/isolate.rs13
2 files changed, 16 insertions, 2 deletions
diff --git a/src/flags.rs b/src/flags.rs
index e4e3c28df..d766fee0c 100644
--- a/src/flags.rs
+++ b/src/flags.rs
@@ -60,7 +60,10 @@ pub fn print_usage() {
-h or --help Print this message.
--v8-options Print V8 command line options.
--deps Print module dependencies.
---types Print runtime TypeScript declarations."
+--types Print runtime TypeScript declarations.
+
+Environment variables:
+DENO_DIR Set deno's base directory."
);
}
diff --git a/src/isolate.rs b/src/isolate.rs
index 5a09b8855..7860b216b 100644
--- a/src/isolate.rs
+++ b/src/isolate.rs
@@ -12,8 +12,10 @@ use libdeno;
use futures::Future;
use libc::c_void;
use std;
+use std::env;
use std::ffi::CStr;
use std::ffi::CString;
+use std::path::Path;
use std::sync::mpsc;
use std::sync::Arc;
use std::sync::Mutex;
@@ -108,6 +110,15 @@ impl Isolate {
// This channel handles sending async messages back to the runtime.
let (tx, rx) = mpsc::channel::<(i32, Buf)>();
+ let custom_root_path;
+ let custom_root = match env::var("DENO_DIR") {
+ Ok(path) => {
+ custom_root_path = path;
+ Some(Path::new(custom_root_path.as_str()))
+ }
+ Err(_e) => None,
+ };
+
Isolate {
libdeno_isolate,
dispatch,
@@ -115,7 +126,7 @@ impl Isolate {
ntasks: 0,
timeout_due: None,
state: Arc::new(IsolateState {
- dir: deno_dir::DenoDir::new(flags.reload, None).unwrap(),
+ dir: deno_dir::DenoDir::new(flags.reload, custom_root).unwrap(),
argv: argv_rest,
flags,
tx: Mutex::new(Some(tx)),