mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 14:52:41 +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 {
|
||||
match fs::metadata(&self.plus(path)) {
|
||||
Ok(m) => m.is_dir(),
|
||||
|
|
Loading…
Reference in a new issue