mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-09 07:17:56 -05:00
fix(fs): correct ReadLink error message and add missing read_link wra… (#19287)
This commit is contained in:
committed by
GitHub
parent
74cc561917
commit
4f660dac85
@@ -39,7 +39,7 @@ pub enum FsPathError {
|
||||
},
|
||||
|
||||
/// Error variant for failed read link operation with additional path context.
|
||||
#[error("failed to read from {path:?}: {source}")]
|
||||
#[error("failed to read link {path:?}: {source}")]
|
||||
ReadLink {
|
||||
/// The source `io::Error`.
|
||||
source: io::Error,
|
||||
@@ -230,6 +230,12 @@ pub fn read(path: impl AsRef<Path>) -> Result<Vec<u8>> {
|
||||
fs::read(path).map_err(|err| FsPathError::read(err, path))
|
||||
}
|
||||
|
||||
/// Wrapper for `std::fs::read_link`
|
||||
pub fn read_link(path: impl AsRef<Path>) -> Result<PathBuf> {
|
||||
let path = path.as_ref();
|
||||
fs::read_link(path).map_err(|err| FsPathError::read_link(err, path))
|
||||
}
|
||||
|
||||
/// Wrapper for `std::fs::write`
|
||||
pub fn write(path: impl AsRef<Path>, contents: impl AsRef<[u8]>) -> Result<()> {
|
||||
let path = path.as_ref();
|
||||
|
||||
Reference in New Issue
Block a user