summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAmos Lim <amoseui@gmail.com>2018-10-16 01:08:19 +0900
committerRyan Dahl <ry@tinyclouds.org>2018-10-15 12:08:19 -0400
commit15590a0cde8901f15d200d433761d11cc5468270 (patch)
tree79514c9465ab81504981010644681fe56ac09e98 /src
parenta327759971fe5cb095e1d2f6125269e60ac00123 (diff)
Specify deno_dir location with env var DENO_DIR (#970)
(Use C:\deno instead of c:\deno in appveyor config because it's cloned to c:\ by clone_folder variable in .appveyor.yml. On the other hand, build directory is pointed to C:\ by $(APPVEYOR_BUILD_FOLDER) so that test targets are placed on separated partitions.)
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)),