fix: 修正restore_index()行为,从index筛选文件而非工作区

This commit is contained in:
mrbeanc
2023-12-23 17:47:57 +08:00
parent 01206ac88e
commit c975d02ef0
3 changed files with 29 additions and 8 deletions

View File

@@ -171,10 +171,14 @@ pub fn format_time(time: &std::time::SystemTime) -> String {
}
/// 过滤出路径数组中的目录
pub fn filter_dirs(paths: &Vec<PathBuf>) -> Vec<PathBuf> {
pub fn filter_dirs(paths: &Vec<PathBuf>) -> HashSet<PathBuf> {
paths.iter().filter(|path| path.is_dir()).cloned().collect()
}
pub fn filter_files(paths: &Vec<PathBuf>) -> HashSet<PathBuf> {
paths.iter().filter(|path| path.is_file()).cloned().collect()
}
/// 将路径中的分隔符统一为当前系统的分隔符
fn unify_path_separator(path: &Path) -> PathBuf {
#[cfg(windows)]