diff options
author | F001 <changchun.fan@qq.com> | 2018-11-30 11:03:00 +0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-11-29 19:03:00 -0800 |
commit | b6fda735ee0106b72500d927b9695a27ecd519f3 (patch) | |
tree | 25b176f3120b1fd7387cc350e86cb24b82eea15e /src/deno_dir.rs | |
parent | 286e76d8c1da135cf159218fe3808fda7405301a (diff) |
Replace mutex by atomics (#1238)
Diffstat (limited to 'src/deno_dir.rs')
-rw-r--r-- | src/deno_dir.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/deno_dir.rs b/src/deno_dir.rs index a7b9f97d6..f75d35bc4 100644 --- a/src/deno_dir.rs +++ b/src/deno_dir.rs @@ -41,16 +41,13 @@ impl DenoDir { // https://github.com/denoland/deno/blob/golang/deno_dir.go#L99-L111 pub fn new( reload: bool, - custom_root: Option<&Path>, + custom_root: Option<PathBuf>, ) -> std::io::Result<Self> { // Only setup once. let home_dir = dirs::home_dir().expect("Could not get home directory."); let default = home_dir.join(".deno"); - let root: PathBuf = match custom_root { - None => default, - Some(path) => path.to_path_buf(), - }; + let root: PathBuf = custom_root.unwrap_or(default); let gen = root.as_path().join("gen"); let deps = root.as_path().join("deps"); let deps_http = deps.join("http"); @@ -390,8 +387,8 @@ pub struct CodeFetchOutput { #[cfg(test)] pub fn test_setup() -> (TempDir, DenoDir) { let temp_dir = TempDir::new().expect("tempdir fail"); - let deno_dir = - DenoDir::new(false, Some(temp_dir.path())).expect("setup fail"); + let deno_dir = DenoDir::new(false, Some(temp_dir.path().to_path_buf())) + .expect("setup fail"); (temp_dir, deno_dir) } |