diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /dom/webgpu/tests/cts/vendor/src/fs.rs | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/webgpu/tests/cts/vendor/src/fs.rs')
-rw-r--r-- | dom/webgpu/tests/cts/vendor/src/fs.rs | 33 |
1 files changed, 24 insertions, 9 deletions
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<P>(path: P) -> P -where - P: AsRef<Path>, -{ - let p = path.as_ref(); - assert!(p.is_file(), "{p:?} does not exist as a file"); - path -} - pub(crate) fn copy_dir<P, Q>(source: P, dest: Q) -> miette::Result<()> where P: Display + AsRef<Path>, @@ -297,6 +288,30 @@ where }) } +pub(crate) fn rename<P1, P2>(from: P1, to: P2) -> miette::Result<()> +where + P1: AsRef<Path>, + P2: AsRef<Path>, +{ + 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<P>(path: P) -> miette::Result<bool> +where + P: AsRef<Path>, +{ + 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<P>(path: P) -> miette::Result<()> where P: AsRef<Path>, |