feat(prune): R3 guarded deletion — confirm-to-delete + panel button
Extend BANK_PRUNE_FOLDER from report-only to dry-run→confirm-with-manifest→ delete exactly the pure-core orphan set (fresh recompute, stale entries skipped). Windows routes to Recycle Bin (SHFileOperation+FOF_ALLOWUNDO), else unlink. New pure prune_button module + footer button dispatching the action id. No ext-state write, no undo point (deletion is not REAPER-undoable).
This commit is contained in:
@@ -195,6 +195,38 @@ public:
|
||||
// folder on disk yet — an unsaved or never-captured project has nothing to reclaim.
|
||||
PruneReport pruneDryRun() const;
|
||||
|
||||
// The FULL (untruncated) prune orphan set for the ACTIVE project — the same fresh
|
||||
// enumerate + pure-core compute pruneDryRun() runs, but returning EVERY orphan (no
|
||||
// 64-cap display clip) as project-relative index-spelled paths, in enumeration order.
|
||||
// The R3 action calls this to obtain the exact set it will CONFIRM and then delete
|
||||
// (pruneDryRun's truncated list is for the console readout; the delete set must be
|
||||
// complete). READ-ONLY — no ext-state, no save, no file mutation. Empty when there is
|
||||
// no active/saved project or no bank folder yet.
|
||||
std::vector<std::string> pruneOrphanSet() const;
|
||||
|
||||
// Phase R (Reclaim), R3: DELETE the confirmed orphan set — the SOLE file-deletion path
|
||||
// in ReaSampler, callable ONLY after an explicit user confirm of a specific manifest.
|
||||
// Given the orphan set the user was shown and confirmed (`confirmed`, typically the
|
||||
// full pruneOrphanSet() captured moments earlier), this re-enumerates the folder, runs
|
||||
// the pure core FRESH, and deletes exactly `confirmed ∩ freshOrphans` (pruneDeletePlan)
|
||||
// so a file that vanished or became referenced between confirm and delete is skipped,
|
||||
// never wrongly deleted — and a newly-appeared orphan the user did NOT see is never
|
||||
// swept. Deletion routes to the OS trash where a portable move-to-trash is verified
|
||||
// (Windows Recycle Bin via SHFileOperation + FOF_ALLOWUNDO); elsewhere it falls back to
|
||||
// std::filesystem unlink behind this confirm guardrail (see persist.cpp for per-platform
|
||||
// routing). Non-throwing: every filesystem call uses error_code forms; a per-file
|
||||
// failure (locked, already gone) is recorded and skipped, never thrown across the C ABI.
|
||||
//
|
||||
// Does NOT modify the BankIndex/book (orphans are unreferenced by definition) and does
|
||||
// NOT modify the OwnedFileManifest (a reclaimed file drops out of the (owned ∩ present)
|
||||
// algebra naturally once it is off disk — no persist write, so no undo-point question
|
||||
// and no risk to the referenced/owned safety). Writes NO ext-state at all.
|
||||
//
|
||||
// No-ops (empty result) when there is no active/saved project, no bank folder, or the
|
||||
// delete plan is empty (everything went stale). The caller is responsible for having
|
||||
// shown the confirm; this method does NOT prompt.
|
||||
PruneDeletionResult pruneReclaim(const std::vector<std::string>& confirmed) const;
|
||||
|
||||
// Poll the active project. Detects a project load (active project changed)
|
||||
// and a Save-As (active project's .rpp path changed) and reacts accordingly.
|
||||
// Intended to be driven by REAPER's "timer" register. Idempotent per tick.
|
||||
|
||||
Reference in New Issue
Block a user