1
0
mirror of https://github.com/jht5945/rust_util.git synced 2025-12-27 23:40:05 +08:00

add is_symlink

This commit is contained in:
2019-08-03 14:15:59 +08:00
parent 4d38c5150c
commit f8dab07f6c

View File

@@ -58,6 +58,13 @@ pub fn get_absolute_path(path: &str) -> Option<PathBuf> {
fs::canonicalize(path).ok()
}
pub fn is_symlink(path: &Path) -> bool {
match path.symlink_metadata() {
Err(_) => false,
Ok(meta) => meta.file_type().is_symlink(),
}
}
pub fn walk_dir<FError, FProcess, FFilter>(dir: &Path,
func_walk_error: &FError,
func_process_file: &FProcess,