Lines Matching full:path

6 use std::path::{Path, PathBuf};
39 ($io_error:expr, $fmt:expr $(, $path:expr)* $(,)?) => {
42 message: format!($fmt $(, $path.display())*),
47 pub(crate) fn copy(from: impl AsRef<Path>, to: impl AsRef<Path>) -> Result<u64> {
56 pub(crate) fn create_dir_all(path: impl AsRef<Path>) -> Result<()> {
57 let path = path.as_ref();
58 match std::fs::create_dir_all(path) {
60 Err(e) => err!(e, "Failed to create directory `{}`", path),
71 pub(crate) fn exists(path: impl AsRef<Path>) -> bool {
72 let path = path.as_ref();
73 // If path is a symlink, this returns true, regardless of whether the
74 // symlink points to a path that exists.
75 std::fs::symlink_metadata(path).is_ok()
78 pub(crate) fn read(path: impl AsRef<Path>) -> Result<Vec<u8>> {
79 let path = path.as_ref();
80 match std::fs::read(path) {
82 Err(e) => err!(e, "Failed to read file `{}`", path),
94 pub(crate) fn remove_file(path: impl AsRef<Path>) -> Result<()> {
95 let path = path.as_ref();
96 match std::fs::remove_file(path) {
98 Err(e) => err!(e, "Failed to remove file `{}`", path),
102 pub(crate) fn remove_dir(path: impl AsRef<Path>) -> Result<()> {
103 let path = path.as_ref();
104 match std::fs::remove_dir(path) {
106 Err(e) => err!(e, "Failed to remove directory `{}`", path),
111 original: &'a Path,
112 link: &'a Path,
113 fun: fn(&'a Path, &'a Path) -> io::Result<()>,
126 pub(crate) fn symlink_fail(original: impl AsRef<Path>, link: impl AsRef<Path>) -> Result<()> {
144 pub(crate) fn symlink_file(original: impl AsRef<Path>, link: impl AsRef<Path>) -> Result<()> {
149 pub(crate) fn symlink_file(original: impl AsRef<Path>, link: impl AsRef<Path>) -> Result<()> {
158 pub(crate) fn symlink_dir(original: impl AsRef<Path>, link: impl AsRef<Path>) -> Result<()> {
166 pub(crate) fn write(path: impl AsRef<Path>, contents: impl AsRef<[u8]>) -> Result<()> {
167 let path = path.as_ref();
168 match std::fs::write(path, contents) {
170 Err(e) => err!(e, "Failed to write file `{}`", path),