A fast, modern, cross-platform folder & file comparison and merge desktop application. A Tauri 2 + Rust core drives a Svelte 4 + TypeScript UI, delivering high-performance directory diffing, word-by-word file comparison, visual image diffing, and safe interactive merges.
DCo follows a hybrid architecture: a memory-safe Rust core performs all heavy compute
(scanning, hashing, diffing, merging), while an OS-rendered Svelte webview provides the UI.
They communicate over Tauri v2 IPC — commands for request/response and
ipc::Channel for streaming progress.
The frontend webview runs on the operating system's native WebView (WKWebView / WebView2 / WebKitGTK), so no browser is bundled. Core compute stays in Rust, keeping the UI snapshot small and memory efficient.
DCo moves from coarse folder-level status down to character-level precision, and safely applies changes back to disk.
Locked 1-to-1 synchronized scrolling across dual pane trees with recursive, collapsed-aware
DIFF highlighting. Recursively scans, then classifies every entry.
Side-by-side line alignment plus intra-line word-level segment highlighting (red = deletions, green = additions). Context filtering isolates affected change blocks.
Inline Copy Right ▶ / ◀ Copy Left actions per hunk, bulk hunk selection,
Apply selected and Export patch, plus atomic .bak backups.
Side-by-side and opacity-overlay comparison for .png .jpg .jpeg .webp .svg .gif .ico
with binary-file detection.
One-way or mirror sync (rightToLeft, leftToRight, mirror)
with orphan pruning and timestamped backups.
Drag folders onto left/right drop zones or tree columns to load new directories instantly, with reactive auto-compare on path entry.
Read-only mode, persistent merge audit log (.dcompare_audit.log), and a
render-side verify_property_ownership guard for the static bundle.
Export comparison reports as CSV, HTML, or plain text. Glob-pattern
ignore rules (node_modules, .git, *.log).
src-tauri
The core is a Rust crate exposed as a lib (cdylib / rlib) named
dcompare_lib. Release builds are optimized with LTO, opt-level 3,
codegen-units 1, and panic = abort.
| Module | Role | Key techniques |
|---|---|---|
scanner.rs |
Parallel directory traversal & manifest comparison | Rayon parallelism, iterative (non-recursive) walk, BLAKE3 hashing, size+mtime pre-filter, cancellation token |
filecmp.rs |
Per-file line extraction & full diff orchestration | Encoding detection (encoding_rs), memory mapping, memchr line splitting, block-hash pre-filter |
diff/myers.rs |
Core edit-script algorithm | Myers O(ND) with V-array trace backtrace & linear-space trim |
diff/patience.rs |
Patience diff for structured-code readability | Unique-common-line anchoring |
diff/blockhash.rs |
Huge-file pre-filter | Parallel block hashing, rolling-window anchor matching |
merge.rs |
Hunk application & backup generation | Staleness re-check, temp-file + atomic rename, timestamped .bak |
encoding.rs |
Charset detection & decoding | encoding_rs label detection |
commands.rs |
Tauri IPC surface & audit log | All #[tauri::command]s, report export, image base64 |
tauri 2Desktop shell, IPC, ipc::Channel streaming, plugins: dialog, opener.
rayon 1Parallel directory walking and block hashing for multi-core throughput.
blake3 1Very fast content hashing for file-equality confirmation.
memmap2 / memchrMemory-mapped reads and cache-friendly line splitting on large files.
tokio 1Async runtime for async commands & non-blocking IO.
encoding_rsCharset detection and UTF-8 transcoding.
ui/src
The UI is a typed Svelte component tree. The single typed gateway (api.ts) wraps
Tauri invoke calls, while components handle rendering, diff state, and merge workflows.
| Component | Role |
|---|---|
App.svelte | Root shell: toolbar, summary header, reactive auto-compare, system theme |
api.ts | Type-safe Tauri IPC binding layer (all backend commands) |
SideBySideTree.svelte | Dual-pane tree with synchronized scrolling & center inspector |
DirTree / DirTreeNode.svelte | Recursive, expandable (explorer-style) tree nodes with DIFF badges |
ThreeWayTree.svelte | Three-way comparison tree listing |
CompareModal.svelte | Full-screen line & image diff workspace |
DiffViewer.svelte | Side-by-side code diff + inline move buttons & "exists only in Left/Right" banners |
MergeBar.svelte | Hunk selection, Apply selected, Export patch |
ImageDiffViewer.svelte | Side-by-side & opacity-overlay image comparison |
CsvDiffViewer / JsonDiffViewer / HexDiffViewer | Structured & binary-oriented inspection modes |
SavedSessionsModal / SettingsModal / AboutModal | Persistence, configuration, and info |
FolderSyncModal.svelte | One-way / mirror folder sync interface |
AuditLogModal.svelte | Merge history & audit log viewer |
Tooling: Vite 5 (dev server, HMR at port 1420) with
@sveltejs/vite-plugin-svelte, svelte-check, ESLint (TypeScript + Svelte), Prettier, and Vitest.
DCo is engineered around real-world directory sizes and careful data-race safety.
Both trees walked in parallel with rayon. Pre-filter by (size, mtime);
expensive BLAKE3 hashing only runs when ambiguity remains.
Files < 8 MB read inline; larger files are memory-mapped (memmap2) and
split with memchr to avoid full copies.
Files > ~200k lines use block-hash pre-filtering to anchor equal regions and diff only the gaps.
Myers O(ND) with trace backtrace plus linear-space prefix/suffix trimming for wide edits.
Scans stream via ipc::Channel with a shared CancellationToken for
responsive Stop; commands use spawn_blocking to keep the UI thread free.
Merges and syncs write via temp + atomic rename and re-check staleness, preventing stale overwrites and partial files.
Prerequisites: Node.js ≥ 18, npm ≥ 9, Rust toolchain ≥ 1.70, plus platform toolchains (Xcode CLT on macOS, WebKitGTK stack on Linux, VS C++ Build Tools on Windows).
| Command | Purpose |
|---|---|
npm run tauri dev | Run in dev with Vite HMR + Rust hot reload |
npm run tauri build | Release bundle (dmg / msi · exe / deb · AppImage) |
cargo test --lib | Rust unit tests (diff, scanner, merge) |
npx svelte-check | Type-check the Svelte/TS UI |
npm test | Vitest frontend suite |