From a90a5cba08fdf6c0ceb95101c275108a152a3aed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:35:37 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- dom/webgpu/tests/cts/vendor/src/fs.rs | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'dom/webgpu/tests/cts/vendor/src/fs.rs') diff --git a/dom/webgpu/tests/cts/vendor/src/fs.rs b/dom/webgpu/tests/cts/vendor/src/fs.rs index 31697f9758..3062f27cdb 100644 --- a/dom/webgpu/tests/cts/vendor/src/fs.rs +++ b/dom/webgpu/tests/cts/vendor/src/fs.rs @@ -245,15 +245,6 @@ impl Display for Child<'_> { } } -pub(crate) fn existing_file

(path: P) -> P -where - P: AsRef, -{ - let p = path.as_ref(); - assert!(p.is_file(), "{p:?} does not exist as a file"); - path -} - pub(crate) fn copy_dir(source: P, dest: Q) -> miette::Result<()> where P: Display + AsRef, @@ -297,6 +288,30 @@ where }) } +pub(crate) fn rename(from: P1, to: P2) -> miette::Result<()> +where + P1: AsRef, + P2: AsRef, +{ + fs::rename(&from, &to).into_diagnostic().wrap_err_with(|| { + format!( + "failed to rename {} to {}", + from.as_ref().display(), + to.as_ref().display() + ) + }) +} + +pub(crate) fn try_exists

(path: P) -> miette::Result +where + P: AsRef, +{ + let path = path.as_ref(); + path.try_exists() + .into_diagnostic() + .wrap_err_with(|| format!("failed to check if path exists: {}", path.display())) +} + pub(crate) fn create_dir_all

(path: P) -> miette::Result<()> where P: AsRef, -- cgit v1.2.3