b02daf1448
- 文件管理器分页加载、排序偏好、桌面表头排序、移动端排序菜单、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。
55 lines
1.9 KiB
Dart
55 lines
1.9 KiB
Dart
import 'dart:io';
|
|
import 'package:external_path/external_path.dart';
|
|
|
|
class SyncDefaults {
|
|
SyncDefaults._();
|
|
|
|
/// 默认同步目录(同步版本,Android 返回空串,需用 getDefaultLocalRoot 异步获取)
|
|
static String defaultLocalRoot() {
|
|
if (Platform.isWindows) {
|
|
return '${Platform.environment['USERPROFILE']}\\Documents\\Cloudreve4';
|
|
} else if (Platform.isLinux) {
|
|
final xdgDownload =
|
|
Platform.environment['XDG_DOWNLOAD_DIR'] ??
|
|
("${Platform.environment['HOME'] ?? ''}/Downloads");
|
|
return '$xdgDownload/Cloudreve4';
|
|
} else if (Platform.isAndroid) {
|
|
return '';
|
|
}
|
|
return '';
|
|
}
|
|
|
|
/// 默认同步目录(异步版本,Android 通过 ExternalPath 获取公共目录)
|
|
static Future<String> getDefaultLocalRoot() async {
|
|
if (Platform.isAndroid) {
|
|
return getDefaultAndroidLocalRoot();
|
|
}
|
|
return defaultLocalRoot();
|
|
}
|
|
|
|
static const String defaultRemoteRoot = 'cloudreve://my';
|
|
static const String defaultSyncMode = 'full';
|
|
static const String defaultConflictStrategy = 'keep_both';
|
|
static const int defaultMaxConcurrentTransfers = 3;
|
|
static const int defaultBandwidthLimitKbps = 0;
|
|
static const int defaultMaxWorkers = 0; // 0 = CPU 核心数
|
|
static const String defaultLogLevel = 'info';
|
|
|
|
// ===== Android 相册同步专用 =====
|
|
static String get defaultAndroidLocalRoot {
|
|
// runtime 获取 DCIM 公共目录,再拼接 /Camera
|
|
// ExternalPath 无法 const,使用 getter 延迟求值
|
|
throw UnsupportedError('Use getDefaultAndroidLocalRoot() instead');
|
|
}
|
|
|
|
static Future<String> getDefaultAndroidLocalRoot() async {
|
|
final dcim = await ExternalPath.getExternalStoragePublicDirectory(
|
|
ExternalPath.DIRECTORY_DCIM,
|
|
);
|
|
return '$dcim/Camera';
|
|
}
|
|
|
|
static const String defaultAndroidRemoteRoot = 'cloudreve://my/DCIM/Camera';
|
|
static const String defaultAndroidSyncMode = 'album_upload';
|
|
}
|