Skip to content

A treemap for finding and removing what fills your disk, for Omarchy. Rust + GPUI.

Rust

docs: describe the elevated scan and new guards

Shishir Paiff139e62d547
diff --git a/AGENTS.md b/AGENTS.md
index ff8491b..0dec4c7 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -63,17 +63,25 @@ and `cargo build --release` directly; CI runs the gate on both systems.
1. **Sizes come from `st_blocks * 512` unless apparent size was asked for.**
That is the number that comes back when a file is deleted. On Windows it
- is the allocation the directory listing reports; see `windows.rs`.
+ is the allocation the directory listing reports; see `windows.rs`. An
+ elevated scan of a whole NTFS drive reads it from the master file table
+ instead, keeping the walk's rules for hidden entries, links, cloud
+ folders and depth; see `mft.rs`. That path counts every stream's
+ allocation, alternate data streams included since they go when the file
+ goes, so for a file with alternate streams it can exceed the walk's
+ number.
2. **`own_bytes`/`own_files` are derived, never tracked.** `tree::aggregate`
- computes the totals from the children. Hardlink de-duplication rewrites a
- leaf's weight and re-aggregates; anything that patches `bytes` directly will
- be overwritten.
+ computes the totals from the children. Hardlink de-duplication zeroes a
+ duplicate leaf's weight while that pass runs; anything that patches
+ `bytes` directly will be overwritten.
3. **A directory is only built when its own scan *and* every subdirectory task
has finished.** That is the `+1` sentinel in `PendingDir::pending`. Building
early silently drops whole subtrees — it has happened once.
4. **Only paths under the scanned root may be removed**, and mount points, the
root, the home directory, any directory holding it, and symlink targets are
- refused.
+ refused. On Windows so is every directory directly in the profiles folder
+ Windows reports (`FOLDERID_UserProfiles`, usually `C:\Users`); what is
+ inside a profile stays removable.
5. **Marks are keyed by absolute path**, not tree position, so they survive a
re-scan; `Marks::refresh` re-reads their sizes and drops what is gone.
6. **The treemap is painted, not composed of elements.** Thousands of
@@ -99,6 +107,7 @@ and `cargo build --release` directly; CI runs the gate on both systems.
| anything that deletes, or refuses to | `crates/disktree-core/src/removal.rs` |
| free space and projections | `crates/disktree-core/src/space.rs` |
| what Windows lists, measures and compares differently | `crates/disktree-core/src/windows.rs` — the only `unsafe` |
+| reading a whole NTFS drive from its file table | `crates/disktree-core/src/mft.rs` |
| a key, a screen transition, a mark | `crates/disktree-app/src/state.rs` |
| spacing, type and size | `crates/disktree-app/src/ui.rs` — tokens only, no `px` in layout |
| the mosaic's painting or labels | `crates/disktree-app/src/treemap_view.rs` |
diff --git a/README.md b/README.md
index e592624..201ee9d 100644
--- a/README.md
+++ b/README.md
@@ -277,14 +277,31 @@ The same program, with Windows' answers to the questions above:
folder another volume is mounted on is a link, like a junction, and is
not entered, so a scan stays on one volume; `-l` follows links, and with
them mounted folders.
+- **Run as administrator** and the whole disk is read from NTFS's master
+ file table instead of walked, as WizTree does: one pass over the table in
+ large reads. On a 4-million-file `C:\` that took about 3.4 s against 11.2
+ s for WizTree and about 20 s for the walk. It also sees what the walk is
+ refused, such as System Volume Information. It is used only for a whole
+ NTFS drive, since a folder would still cost the whole table, and not with
+ `-l`, whose links the table does not follow. disktree flushes the volume
+ after its own removals so the rescan shows them; changes other programs
+ made seconds before may not show yet.
+ Started without admin rights, disktree walks as before. On a whole NTFS
+ drive without `-l`, or once Windows refuses the walk a folder, the side
+ panel offers **Restart as Administrator**, which reopens the same folder
+ and options through the UAC prompt; during a widening scan, the wider
+ folder being scanned.
- **Move to trash** is the Recycle Bin, through the shell, which asks
before destroying anything it cannot recycle.
- **Refused besides the rules below:** Windows, Program Files and
ProgramData, what Windows keeps at the top of its drive (System Volume
Information, Recovery, Boot, and the page and hibernation files, which
- Settings turns off), and any folder holding your profile, such as
- `C:\Users`. Names compare without regard to case, as Windows compares
- them.
+ Settings turns off), any folder holding your profile, such as
+ `C:\Users`, and every profile in the folder Windows keeps them in
+ (`C:\Users\*`, `Public` and `Default` included), since an elevated
+ disktree may run as another account and can reach them all. What is
+ inside a profile can still be removed, as under your own. Names compare
+ without regard to case, as Windows compares them.
- **Hidden** means a name starting with a dot, or the hidden attribute, so
`-H` drops `AppData` as Explorer hides it.
- **The theme** follows Windows' light or dark setting, since there is no