mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
tests/common/util: add AtPath::symlink_exists()
Add helper method for deciding whether a symbolic link exists in the test directory.
This commit is contained in:
parent
03b208cb9d
commit
78a11ad69b
1 changed files with 8 additions and 0 deletions
|
@ -755,6 +755,14 @@ impl AtPath {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Decide whether the named symbolic link exists in the test directory.
|
||||||
|
pub fn symlink_exists(&self, path: &str) -> bool {
|
||||||
|
match fs::symlink_metadata(&self.plus(path)) {
|
||||||
|
Ok(m) => m.file_type().is_symlink(),
|
||||||
|
Err(_) => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn dir_exists(&self, path: &str) -> bool {
|
pub fn dir_exists(&self, path: &str) -> bool {
|
||||||
match fs::metadata(&self.plus(path)) {
|
match fs::metadata(&self.plus(path)) {
|
||||||
Ok(m) => m.is_dir(),
|
Ok(m) => m.is_dir(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue