mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 04:52:26 -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",
|
"typed-arena",
|
||||||
"uuid",
|
"uuid",
|
||||||
"walkdir",
|
"walkdir",
|
||||||
"which 4.4.2",
|
"which",
|
||||||
"winapi",
|
"winapi",
|
||||||
"winres",
|
"winres",
|
||||||
"zeromq",
|
"zeromq",
|
||||||
|
@ -1996,7 +1996,6 @@ dependencies = [
|
||||||
"faster-hex",
|
"faster-hex",
|
||||||
"h2 0.4.4",
|
"h2 0.4.4",
|
||||||
"hkdf",
|
"hkdf",
|
||||||
"home",
|
|
||||||
"http 1.1.0",
|
"http 1.1.0",
|
||||||
"http-body-util",
|
"http-body-util",
|
||||||
"hyper 1.4.1",
|
"hyper 1.4.1",
|
||||||
|
@ -2179,7 +2178,7 @@ dependencies = [
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 2.0.3",
|
"thiserror 2.0.3",
|
||||||
"which 4.4.2",
|
"which",
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2268,7 +2267,7 @@ dependencies = [
|
||||||
"tokio-metrics",
|
"tokio-metrics",
|
||||||
"twox-hash",
|
"twox-hash",
|
||||||
"uuid",
|
"uuid",
|
||||||
"which 4.4.2",
|
"which",
|
||||||
"winapi",
|
"winapi",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
@ -8432,7 +8431,7 @@ dependencies = [
|
||||||
"miniz_oxide",
|
"miniz_oxide",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"paste",
|
"paste",
|
||||||
"which 6.0.1",
|
"which",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -8742,18 +8741,6 @@ dependencies = [
|
||||||
"web-sys",
|
"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]]
|
[[package]]
|
||||||
name = "which"
|
name = "which"
|
||||||
version = "6.0.1"
|
version = "6.0.1"
|
||||||
|
|
|
@ -212,7 +212,7 @@ url = { version = "2.5", features = ["serde", "expose_internals"] }
|
||||||
uuid = { version = "1.3.0", features = ["v4"] }
|
uuid = { version = "1.3.0", features = ["v4"] }
|
||||||
webpki-root-certs = "0.26.5"
|
webpki-root-certs = "0.26.5"
|
||||||
webpki-roots = "0.26"
|
webpki-roots = "0.26"
|
||||||
which = "4.2.5"
|
which = "6"
|
||||||
yoke = { version = "0.7.4", features = ["derive"] }
|
yoke = { version = "0.7.4", features = ["derive"] }
|
||||||
zeromq = { version = "=0.4.1", default-features = false, features = ["tcp-transport", "tokio-runtime"] }
|
zeromq = { version = "=0.4.1", default-features = false, features = ["tcp-transport", "tokio-runtime"] }
|
||||||
zstd = "=0.12.4"
|
zstd = "=0.12.4"
|
||||||
|
|
|
@ -49,7 +49,6 @@ errno = "0.2.8"
|
||||||
faster-hex.workspace = true
|
faster-hex.workspace = true
|
||||||
h2.workspace = true
|
h2.workspace = true
|
||||||
hkdf.workspace = true
|
hkdf.workspace = true
|
||||||
home = "0.5.9"
|
|
||||||
http.workspace = true
|
http.workspace = true
|
||||||
http-body-util.workspace = true
|
http-body-util.workspace = true
|
||||||
hyper.workspace = true
|
hyper.workspace = true
|
||||||
|
@ -93,7 +92,7 @@ simd-json = "0.14.0"
|
||||||
sm3 = "0.4.2"
|
sm3 = "0.4.2"
|
||||||
spki.workspace = true
|
spki.workspace = true
|
||||||
stable_deref_trait = "1.2.0"
|
stable_deref_trait = "1.2.0"
|
||||||
sys_traits = { workspace = true, features = ["real"] }
|
sys_traits = { workspace = true, features = ["real", "winapi", "libc"] }
|
||||||
thiserror.workspace = true
|
thiserror.workspace = true
|
||||||
tokio.workspace = true
|
tokio.workspace = true
|
||||||
tokio-eld = "0.2"
|
tokio-eld = "0.2"
|
||||||
|
|
|
@ -4,6 +4,7 @@ use std::mem::MaybeUninit;
|
||||||
|
|
||||||
use deno_core::op2;
|
use deno_core::op2;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
|
use sys_traits::EnvHomeDir;
|
||||||
|
|
||||||
use crate::NodePermissions;
|
use crate::NodePermissions;
|
||||||
|
|
||||||
|
@ -282,5 +283,9 @@ where
|
||||||
permissions.check_sys("homedir", "node:os.homedir()")?;
|
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) {
|
match which::which_in(text, std::env::var_os("PATH"), cwd) {
|
||||||
Ok(path) => path,
|
Ok(path) => path,
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
which::Error::BadAbsolutePath | which::Error::BadRelativePath => {
|
which::Error::CannotGetCurrentDirAndPathListEmpty => {
|
||||||
return Err(err);
|
return Err(err);
|
||||||
}
|
}
|
||||||
which::Error::CannotFindBinaryPath
|
which::Error::CannotFindBinaryPath
|
||||||
| which::Error::CannotGetCurrentDir
|
|
||||||
| which::Error::CannotCanonicalize => {
|
| which::Error::CannotCanonicalize => {
|
||||||
return Ok(AllowRunDescriptorParseResult::Unresolved(Box::new(err)))
|
return Ok(AllowRunDescriptorParseResult::Unresolved(Box::new(err)))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue