主要合入内容:
- 文件管理器分页加载、排序偏好、桌面表头排序、移动端排序菜单、Ctrl/Cmd+F搜索、Esc 关闭搜索、鼠标右滑返回上级。 - 移动端同步状态页、同步统计卡片、同步任务/累计统计事件、同步页布局更新。 - Android 相册同步默认路径改为 DCIM/Camera,下载路径改用 external_path。 - Rust sync-core 更新:Android 日志依赖、AlbumUpload/AlbumDownload、MirrorWcf 统计修复、Linux FUSE镜像挂载与读写同步支持。 - 依赖更新:external_path、fl_chart、pdfrx 升级,并修了 pdfrx 新版本的deprecated API。 - 新增文件包括:sort_options.dart、sync_page_android.dart、sync_stats_card.dart、platform/fuse.rs、sync_engine/fuse.rs。
This commit is contained in:
@@ -1,23 +1,16 @@
|
||||
#[cfg(unix)]
|
||||
use std::collections::HashSet;
|
||||
use crate::errors::Result;
|
||||
use crate::models::LocalFileEntry;
|
||||
use crate::utils::quick_hash;
|
||||
#[cfg(unix)]
|
||||
use std::collections::HashSet;
|
||||
use std::path::Path;
|
||||
use walkdir::WalkDir;
|
||||
|
||||
/// 需要跳过的文件/目录名前缀和名称
|
||||
pub const SKIP_NAMES: &[&str] = &[
|
||||
".DS_Store",
|
||||
"Thumbs.db",
|
||||
"desktop.ini",
|
||||
];
|
||||
pub const SKIP_NAMES: &[&str] = &[".DS_Store", "Thumbs.db", "desktop.ini"];
|
||||
|
||||
/// 需要跳过的文件扩展名(同步临时文件)
|
||||
pub const SKIP_EXTENSIONS: &[&str] = &[
|
||||
"sync_tmp",
|
||||
"sync_temp",
|
||||
];
|
||||
pub const SKIP_EXTENSIONS: &[&str] = &["sync_tmp", "sync_temp"];
|
||||
|
||||
pub struct FsScanner;
|
||||
|
||||
@@ -58,6 +51,15 @@ impl FsScanner {
|
||||
}
|
||||
};
|
||||
|
||||
let file_name = entry.file_name().to_string_lossy();
|
||||
let depth = entry.depth();
|
||||
tracing::trace!(
|
||||
"扫描: depth={}, is_dir={}, name={}",
|
||||
depth,
|
||||
entry.file_type().is_dir(),
|
||||
file_name
|
||||
);
|
||||
|
||||
// 符号链接处理
|
||||
if entry.path_is_symlink() && !follow_symlinks {
|
||||
continue;
|
||||
@@ -68,6 +70,10 @@ impl FsScanner {
|
||||
if SKIP_NAMES.iter().any(|s| file_name == *s) {
|
||||
continue;
|
||||
}
|
||||
// 跳过隐藏目录/文件(以 . 开头)
|
||||
if file_name.starts_with('.') {
|
||||
continue;
|
||||
}
|
||||
if file_name.starts_with(".sync_") {
|
||||
continue;
|
||||
}
|
||||
@@ -100,7 +106,9 @@ impl FsScanner {
|
||||
}
|
||||
}
|
||||
|
||||
let relative_path = entry.path().strip_prefix(root)
|
||||
let relative_path = entry
|
||||
.path()
|
||||
.strip_prefix(root)
|
||||
.unwrap_or(entry.path())
|
||||
.to_path_buf();
|
||||
|
||||
@@ -120,7 +128,8 @@ impl FsScanner {
|
||||
});
|
||||
} else if metadata.is_file() {
|
||||
let size = metadata.len();
|
||||
let mtime_ms = metadata.modified()
|
||||
let mtime_ms = metadata
|
||||
.modified()
|
||||
.ok()
|
||||
.and_then(|t| t.duration_since(std::time::UNIX_EPOCH).ok())
|
||||
.map(|d| d.as_millis() as i64)
|
||||
@@ -144,13 +153,20 @@ impl FsScanner {
|
||||
}
|
||||
}
|
||||
|
||||
let dirs = entries.iter().filter(|e| e.is_dir).count();
|
||||
let files = entries.iter().filter(|e| !e.is_dir).count();
|
||||
tracing::debug!(
|
||||
"扫描完成: {} 个条目 ({} 目录, {} 文件)",
|
||||
entries.len(),
|
||||
dirs,
|
||||
files
|
||||
);
|
||||
|
||||
Ok(entries)
|
||||
}
|
||||
}
|
||||
|
||||
/// 根据文件扩展名推断 MIME 类型
|
||||
pub fn guess_mime_type(path: &Path) -> Option<String> {
|
||||
mime_guess::from_path(path)
|
||||
.first()
|
||||
.map(|m| m.to_string())
|
||||
mime_guess::from_path(path).first().map(|m| m.to_string())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user