mirror of
https://github.com/denoland/deno.git
synced 2025-01-08 07:08:27 -05:00
refactor: remove use of home crate (#27516)
The two places mentioned in the issue are now consolidated. Closes https://github.com/denoland/deno/issues/24385
This commit is contained in:
parent
225c3dea87
commit
0457c38d4f
5 changed files with 13 additions and 23 deletions
21
Cargo.lock
generated
21
Cargo.lock
generated
|
@ -1355,7 +1355,7 @@ dependencies = [
|
|||
"typed-arena",
|
||||
"uuid",
|
||||
"walkdir",
|
||||
"which 4.4.2",
|
||||
"which",
|
||||
"winapi",
|
||||
"winres",
|
||||
"zeromq",
|
||||
|
@ -1996,7 +1996,6 @@ dependencies = [
|
|||
"faster-hex",
|
||||
"h2 0.4.4",
|
||||
"hkdf",
|
||||
"home",
|
||||
"http 1.1.0",
|
||||
"http-body-util",
|
||||
"hyper 1.4.1",
|
||||
|
@ -2179,7 +2178,7 @@ dependencies = [
|
|||
"percent-encoding",
|
||||
"serde",
|
||||
"thiserror 2.0.3",
|
||||
"which 4.4.2",
|
||||
"which",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
|
@ -2268,7 +2267,7 @@ dependencies = [
|
|||
"tokio-metrics",
|
||||
"twox-hash",
|
||||
"uuid",
|
||||
"which 4.4.2",
|
||||
"which",
|
||||
"winapi",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
@ -8432,7 +8431,7 @@ dependencies = [
|
|||
"miniz_oxide",
|
||||
"once_cell",
|
||||
"paste",
|
||||
"which 6.0.1",
|
||||
"which",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -8742,18 +8741,6 @@ dependencies = [
|
|||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "4.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
|
||||
dependencies = [
|
||||
"either",
|
||||
"home",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "6.0.1"
|
||||
|
|
|
@ -212,7 +212,7 @@ url = { version = "2.5", features = ["serde", "expose_internals"] }
|
|||
uuid = { version = "1.3.0", features = ["v4"] }
|
||||
webpki-root-certs = "0.26.5"
|
||||
webpki-roots = "0.26"
|
||||
which = "4.2.5"
|
||||
which = "6"
|
||||
yoke = { version = "0.7.4", features = ["derive"] }
|
||||
zeromq = { version = "=0.4.1", default-features = false, features = ["tcp-transport", "tokio-runtime"] }
|
||||
zstd = "=0.12.4"
|
||||
|
|
|
@ -49,7 +49,6 @@ errno = "0.2.8"
|
|||
faster-hex.workspace = true
|
||||
h2.workspace = true
|
||||
hkdf.workspace = true
|
||||
home = "0.5.9"
|
||||
http.workspace = true
|
||||
http-body-util.workspace = true
|
||||
hyper.workspace = true
|
||||
|
@ -93,7 +92,7 @@ simd-json = "0.14.0"
|
|||
sm3 = "0.4.2"
|
||||
spki.workspace = true
|
||||
stable_deref_trait = "1.2.0"
|
||||
sys_traits = { workspace = true, features = ["real"] }
|
||||
sys_traits = { workspace = true, features = ["real", "winapi", "libc"] }
|
||||
thiserror.workspace = true
|
||||
tokio.workspace = true
|
||||
tokio-eld = "0.2"
|
||||
|
|
|
@ -4,6 +4,7 @@ use std::mem::MaybeUninit;
|
|||
|
||||
use deno_core::op2;
|
||||
use deno_core::OpState;
|
||||
use sys_traits::EnvHomeDir;
|
||||
|
||||
use crate::NodePermissions;
|
||||
|
||||
|
@ -282,5 +283,9 @@ where
|
|||
permissions.check_sys("homedir", "node:os.homedir()")?;
|
||||
}
|
||||
|
||||
Ok(home::home_dir().map(|path| path.to_string_lossy().to_string()))
|
||||
Ok(
|
||||
sys_traits::impls::RealSys
|
||||
.env_home_dir()
|
||||
.map(|path| path.to_string_lossy().to_string()),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1510,11 +1510,10 @@ impl AllowRunDescriptor {
|
|||
match which::which_in(text, std::env::var_os("PATH"), cwd) {
|
||||
Ok(path) => path,
|
||||
Err(err) => match err {
|
||||
which::Error::BadAbsolutePath | which::Error::BadRelativePath => {
|
||||
which::Error::CannotGetCurrentDirAndPathListEmpty => {
|
||||
return Err(err);
|
||||
}
|
||||
which::Error::CannotFindBinaryPath
|
||||
| which::Error::CannotGetCurrentDir
|
||||
| which::Error::CannotCanonicalize => {
|
||||
return Ok(AllowRunDescriptorParseResult::Unresolved(Box::new(err)))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue