summaryrefslogtreecommitdiff
path: root/cli/tools/installer.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2022-11-28 17:28:54 -0500
committerGitHub <noreply@github.com>2022-11-28 17:28:54 -0500
commit2d4c46c975eb916dc622cc729a1a8d397582a76f (patch)
tree445e819117acd2f94ffc9d7da7ed8e3e604435d0 /cli/tools/installer.rs
parentf526513d74d34ac254aa40ef9b73238cb21c395b (diff)
refactor: create util folder, move nap_sym to napi/sym, move http_cache to cache folder (#16857)
Diffstat (limited to 'cli/tools/installer.rs')
-rw-r--r--cli/tools/installer.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/cli/tools/installer.rs b/cli/tools/installer.rs
index b964619d9..6914c9919 100644
--- a/cli/tools/installer.rs
+++ b/cli/tools/installer.rs
@@ -4,8 +4,8 @@ use crate::args::ConfigFlag;
use crate::args::Flags;
use crate::args::InstallFlags;
use crate::args::TypeCheckMode;
-use crate::fs_util;
use crate::npm::NpmPackageReference;
+use crate::util::fs::canonicalize_path_maybe_not_exists;
use deno_core::anyhow::Context;
use deno_core::error::generic_error;
use deno_core::error::AnyError;
@@ -107,9 +107,7 @@ exec deno {} "$@"
fn get_installer_root() -> Result<PathBuf, io::Error> {
if let Ok(env_dir) = env::var("DENO_INSTALL_ROOT") {
if !env_dir.is_empty() {
- return fs_util::canonicalize_path_maybe_not_exists(&PathBuf::from(
- env_dir,
- ));
+ return canonicalize_path_maybe_not_exists(&PathBuf::from(env_dir));
}
}
// Note: on Windows, the $HOME environment variable may be set by users or by
@@ -167,7 +165,7 @@ pub fn infer_name_from_url(url: &Url) -> Option<String> {
pub fn uninstall(name: String, root: Option<PathBuf>) -> Result<(), AnyError> {
let root = if let Some(root) = root {
- fs_util::canonicalize_path_maybe_not_exists(&root)?
+ canonicalize_path_maybe_not_exists(&root)?
} else {
get_installer_root()?
};
@@ -275,7 +273,7 @@ fn resolve_shim_data(
install_flags: &InstallFlags,
) -> Result<ShimData, AnyError> {
let root = if let Some(root) = &install_flags.root {
- fs_util::canonicalize_path_maybe_not_exists(root)?
+ canonicalize_path_maybe_not_exists(root)?
} else {
get_installer_root()?
};
@@ -450,6 +448,7 @@ mod tests {
use super::*;
use crate::args::ConfigFlag;
+ use crate::util::fs::canonicalize_path;
use std::process::Command;
use test_util::testdata_path;
use test_util::TempDir;
@@ -746,7 +745,7 @@ mod tests {
#[test]
fn install_npm_lockfile_default() {
- let temp_dir = fs_util::canonicalize_path(&env::temp_dir()).unwrap();
+ let temp_dir = canonicalize_path(&env::temp_dir()).unwrap();
let shim_data = resolve_shim_data(
&Flags {
allow_all: true,