Skip to content

Commit 2bbcbd1

Browse files
authored
refactor: update to deno_path_util 0.5.0 (#90)
1 parent 5eef442 commit 2bbcbd1

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rs_lib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ chrono = { version = "0.4", default-features = false, features = ["std"], option
2626
data-url = { version = "0.3.0", optional = true }
2727
deno_error = { version = "0.6.0", features =["url"] }
2828
deno_media_type = "0.2.2"
29-
deno_path_util = "0.4.0"
29+
deno_path_util = "0.5.0"
3030
sys_traits.workspace = true
3131
http = { version = "1", optional = true }
3232
indexmap = { version = "2.0.0", features = ["serde"] }

rs_lib/src/npm.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright 2018-2025 the Deno authors. MIT license.
22

3+
use std::borrow::Cow;
34
use std::io::ErrorKind;
45
use std::path::Path;
56
use std::path::PathBuf;
@@ -51,9 +52,10 @@ impl NpmCacheDir {
5152
}
5253

5354
// this may fail on readonly file systems, so just ignore if so
54-
let root_dir = normalize_path(root_dir);
55-
let root_dir =
56-
try_get_canonicalized_root_dir(sys, &root_dir).unwrap_or(root_dir);
55+
let root_dir = normalize_path(Cow::Owned(root_dir));
56+
let root_dir = try_get_canonicalized_root_dir(sys, &root_dir)
57+
.map(Cow::Owned)
58+
.unwrap_or(root_dir);
5759
let root_dir_url = url_from_directory_path(&root_dir).unwrap();
5860

5961
let known_registries_dirnames: Vec<_> = known_registries_urls
@@ -66,7 +68,7 @@ impl NpmCacheDir {
6668
.collect();
6769

6870
Self {
69-
root_dir,
71+
root_dir: root_dir.into_owned(),
7072
root_dir_url,
7173
known_registries_dirnames,
7274
}

0 commit comments

Comments
 (0)