fix(compile): handle when DENO_DIR is readonly (#19257)

Closes #19253
This commit is contained in:
David Sherret 2023-05-25 14:27:45 -04:00 committed by GitHub
parent 76400149a4
commit 2ebd61ee1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 134 additions and 72 deletions

View file

@ -67,7 +67,6 @@ use std::path::PathBuf;
use std::sync::Arc;
use thiserror::Error;
use crate::cache::DenoDir;
use crate::file_fetcher::FileFetcher;
use crate::npm::CliNpmRegistryApi;
use crate::npm::NpmProcessState;
@ -724,10 +723,6 @@ impl CliOptions {
}
}
pub fn resolve_deno_dir(&self) -> Result<DenoDir, AnyError> {
Ok(DenoDir::new(self.maybe_custom_root())?)
}
/// Based on an optional command line import map path and an optional
/// configuration file, return a resolved module specifier to an import map
/// and a boolean indicating if unknown keys should not result in diagnostics.
@ -1114,12 +1109,8 @@ impl CliOptions {
&self.flags.location
}
pub fn maybe_custom_root(&self) -> Option<PathBuf> {
self
.flags
.cache_path
.clone()
.or_else(|| env::var("DENO_DIR").map(String::into).ok())
pub fn maybe_custom_root(&self) -> &Option<PathBuf> {
&self.flags.cache_path
}
pub fn no_clear_screen(&self) -> bool {