diff options
Diffstat (limited to 'cli/deno_dir.rs')
-rw-r--r-- | cli/deno_dir.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/cli/deno_dir.rs b/cli/deno_dir.rs index 674d32c51..ca6f8b81f 100644 --- a/cli/deno_dir.rs +++ b/cli/deno_dir.rs @@ -16,11 +16,7 @@ pub struct DenoDir { impl DenoDir { pub fn new(maybe_custom_root: Option<PathBuf>) -> std::io::Result<Self> { let root: PathBuf = if let Some(root) = maybe_custom_root { - if root.is_absolute() { - root - } else { - std::env::current_dir()?.join(root) - } + root } else if let Some(cache_dir) = dirs::cache_dir() { // We use the OS cache dir because all files deno writes are cache files // Once that changes we need to start using different roots if DENO_DIR @@ -32,6 +28,11 @@ impl DenoDir { } else { panic!("Could not set the Deno root directory") }; + let root = if root.is_absolute() { + root + } else { + std::env::current_dir()?.join(root) + }; assert!(root.is_absolute()); let gen_path = root.join("gen"); |