From d41e29a24f2001728dd5e6be04d941ef246dfc99 Mon Sep 17 00:00:00 2001 From: FredApps Date: Fri, 6 Nov 2026 17:50:34 +0100 Subject: [PATCH] fix(ui): identify the active scratch directory in warnings --- crates/ui-egui/src/prefs/prefs_ui/fields.rs | 10 ++++++++-- docs/development.md | 7 +++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/prefs/prefs_ui/fields.rs b/crates/ui-egui/src/prefs/prefs_ui/fields.rs index 173421736ef..6b02ddf785c 100644 --- a/crates/ui-egui/src/prefs/prefs_ui/fields.rs +++ b/crates/ui-egui/src/prefs/prefs_ui/fields.rs @@ -522,8 +522,14 @@ fn field_rows(ui: &mut egui::Ui, section: &str, obj: &mut Map, ke if ui.small_button(tl!("Add disk")).clicked() { items.push(json!({"enabled": true, "path": ""})); } - if photocraft_raster::spill::free_space_unmeasured() { - ui.add(egui::Label::new(RichText::new(tl!("This scratch disk doesn't report its free space, so PhotoCraft can't stop before it fills up, and large files get no extra room from it without a Scratch Size Limit. Set a limit or use a local disk.")).color(t.warning)).wrap()); + let scratch = photocraft_raster::spill::stats(); + if scratch.free_space_unmeasured { + let dir = scratch.dir.as_deref().map(|p| p.display().to_string()).unwrap_or_else(|| tl!("Unknown").into()); + let warning = crate::i18n::fmt( + tl!("The current scratch directory ({path}) doesn't report its free space, so PhotoCraft can't stop before it fills up, and large files get no extra room from it without a Scratch Size Limit. This warning applies to the current configuration; changes above take effect on Apply or OK. Set a limit or use a local disk."), + &[("path", &dir)], + ); + ui.add(egui::Label::new(RichText::new(warning).color(t.warning)).wrap()); } }); obj.insert(k, Value::Array(items)); diff --git a/docs/development.md b/docs/development.md index 9db419fb951..0a8069cc441 100644 --- a/docs/development.md +++ b/docs/development.md @@ -866,9 +866,12 @@ physical RAM (excluding swap) and, where measurable, system commit headroom: opened without Photoshop layers. Headless RPC and MCP report approval-required memory errors with byte counts (`required`, -`softLimit`, `hardLimit`, and `availableRam` when known). A hard-budget refusal reports +`softLimit`, `hardLimit`, and `availableRam` when known); here `availableRam` means available +physical RAM. A hard-budget refusal reports `required` and `hardLimit`, plus `available` and `availableRam` when measured free memory set the -limit (the typed `free_memory` field); there is never a soft limit, because no approval can raise +limit (the typed `free_memory` field). Both fields then contain the smaller of available RAM and +commit headroom (or the one measurement available), so `availableRam` can represent commit +headroom rather than physical RAM. There is never a soft limit, because no approval can raise that ceiling. A limit set by the caller, the platform cap, or an unknown capacity carries no free-memory figure. This holds for `doc.open` and `doc.place` and for the MCP `doc_open` and `doc_place` tools, including a refusal from `file.openAs`/`file.placeEmbedded` reached through a