Lines Matching +full:fs +full:- +full:err
17 pub fn kind(&self) -> io::ErrorKind { in kind()
26 fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { in fmt()
32 fn source(&self) -> Option<&(dyn StdError + 'static)> { in source()
38 macro_rules! err { macro
40 Err(Error {
47 pub(crate) fn copy(from: impl AsRef<Path>, to: impl AsRef<Path>) -> Result<u64> { in copy()
50 match std::fs::copy(from, to) { in copy()
52 Err(e) => err!(e, "Failed to copy `{}` -> `{}`", from, to), in copy()
56 pub(crate) fn create_dir_all(path: impl AsRef<Path>) -> Result<()> { in create_dir_all()
58 match std::fs::create_dir_all(path) { in create_dir_all()
60 Err(e) => err!(e, "Failed to create directory `{}`", path), in create_dir_all()
64 pub(crate) fn current_dir() -> Result<PathBuf> { in current_dir()
67 Err(e) => err!(e, "Failed to determine current directory"), in current_dir()
71 pub(crate) fn exists(path: impl AsRef<Path>) -> bool { in exists()
75 std::fs::symlink_metadata(path).is_ok() in exists()
78 pub(crate) fn read(path: impl AsRef<Path>) -> Result<Vec<u8>> { in read()
80 match std::fs::read(path) { in read()
82 Err(e) => err!(e, "Failed to read file `{}`", path), in read()
86 pub(crate) fn read_stdin() -> Result<Vec<u8>> { in read_stdin()
90 Err(e) => err!(e, "Failed to read input from stdin"), in read_stdin()
94 pub(crate) fn remove_file(path: impl AsRef<Path>) -> Result<()> { in remove_file()
96 match std::fs::remove_file(path) { in remove_file()
98 Err(e) => err!(e, "Failed to remove file `{}`", path), in remove_file()
102 pub(crate) fn remove_dir(path: impl AsRef<Path>) -> Result<()> { in remove_dir()
104 match std::fs::remove_dir(path) { in remove_dir()
106 Err(e) => err!(e, "Failed to remove directory `{}`", path), in remove_dir()
113 fun: fn(&'a Path, &'a Path) -> io::Result<()>, in symlink()
114 ) -> Result<()> { in symlink()
117 Err(e) => err!( in symlink()
126 pub(crate) fn symlink_fail(original: impl AsRef<Path>, link: impl AsRef<Path>) -> Result<()> { in symlink_fail()
127 err!( in symlink_fail()
144 pub(crate) fn symlink_file(original: impl AsRef<Path>, link: impl AsRef<Path>) -> Result<()> { in symlink_file()
145 symlink(original.as_ref(), link.as_ref(), std::os::unix::fs::symlink) in symlink_file()
149 pub(crate) fn symlink_file(original: impl AsRef<Path>, link: impl AsRef<Path>) -> Result<()> { in symlink_file()
153 std::os::windows::fs::symlink_file, in symlink_file()
158 pub(crate) fn symlink_dir(original: impl AsRef<Path>, link: impl AsRef<Path>) -> Result<()> { in symlink_dir()
162 std::os::windows::fs::symlink_dir, in symlink_dir()
166 pub(crate) fn write(path: impl AsRef<Path>, contents: impl AsRef<[u8]>) -> Result<()> { in write()
168 match std::fs::write(path, contents) { in write()
170 Err(e) => err!(e, "Failed to write file `{}`", path), in write()