fix(app): captures show no machine paths, Server row actions stay on one line

The capture's data folder lives in the machine's temporary folder, so 8
baselines showed %TEMP% and the user name and differed on any other machine.
AppEnvironment.Shown now shows a capture's folders as a sample user's
(C:\Users\Studio\AppData\Local\Chronos, the sample archive as D:\ChronosArchive)
in Settings > Storage, Workspace and Advanced, the Rebuild index dialog and the
cache's Clear confirmation; AppEnvironment.Actual maps a typed path back, so the
capture still writes only to its temporary folder. Two captures with different
TEMP folders are identical.

On the Server screen the row actions column is at least 400 px wide, so a
remote row's three actions (an older server's disabled Open in workspace after
Open with proxies and Download originals, as BRIEF 12.7 asks) fit one 40 px
line at the capture size instead of wrapping.

Baselines recaptured: server, server-sync, server-conflict, server-signedout
(column layout; the disabled action of phase 5b), settings-storage,
settings-workspace, settings-advanced and archive-rebuild (sample paths), light
and dark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-04 13:54:26 +01:00
1 parent 5ff9c086fd
commit bc4d8e0768
22 files changed
+104 -20

No files matched your search

@@ -57,9 +57,68 @@ public sealed class AppEnvironment
return new(paths.DataRoot, paths.IsPortable, isCapture: false, paths.SyncedFolder, paths.PortableSyncRoot, paths.EarlierPortableData);
}
/// <summary>
/// The data folder a capture shows in place of its temporary one (<see cref="Shown"/>): the default data folder of a
/// sample user, so the screenshots show no path of the machine (its temporary folder, its user name).
/// </summary>
public const string SampleDataDirectory = @"C:\Users\Studio\AppData\Local\Chronos";
/// <summary>The folder a capture shows for its sample archive (<c>archive</c> in its data folder), as the sample settings name it.</summary>
public const string SampleArchiveDirectory = @"D:\ChronosArchive";
/// <summary>The temporary data folder of the capture this process runs (the last one made); null outside a capture.</summary>
private static string? _captureData;
/// <summary>A fresh temporary data folder for screenshots and smoke tests; delete it with <see cref="DeleteCaptureData"/>.</summary>
public static AppEnvironment ForCapture() =>
new(Path.Combine(Path.GetTempPath(), "chronos-capture-" + Guid.CreateVersion7().ToString("N")), portable: false, isCapture: true);
public static AppEnvironment ForCapture()
{
var environment = new AppEnvironment(Path.Combine(Path.GetTempPath(), "chronos-capture-" + Guid.CreateVersion7().ToString("N")), portable: false, isCapture: true);
_captureData = environment.DataDirectory;
return environment;
}
/// <summary>
/// A path as the screens show it: one under a capture's temporary data folder as under <see cref="SampleDataDirectory"/>
/// (its sample archive as <see cref="SampleArchiveDirectory"/>), so the screenshots show nothing of the machine; any
/// other as it is. Only for text on screen: a path typed there goes through <see cref="Actual"/>.
/// </summary>
public static string Shown(string path) => Shown(path, _captureData);
/// <summary>A path typed or shown on screen as the one it stands for: <see cref="Shown(string)"/> undone, so a capture never writes outside its temporary folder.</summary>
public static string Actual(string shown) => Actual(shown, _captureData);
/// <summary><see cref="Shown(string)"/> for the capture whose data folder is <paramref name="captureData"/> (none: the path as it is).</summary>
internal static string Shown(string path, string? captureData)
{
foreach (var (actual, shown) in CaptureFolders(captureData))
{
if (Swap(path, actual, shown) is { } swapped) return swapped;
}
return path;
}
/// <summary><see cref="Actual(string)"/> for the capture whose data folder is <paramref name="captureData"/>.</summary>
internal static string Actual(string shown, string? captureData)
{
foreach (var (actual, sample) in CaptureFolders(captureData))
{
if (Swap(shown, sample, actual) is { } swapped) return swapped;
}
return shown;
}
/// <summary>A capture's folders and what the screens show for each, the more specific first.</summary>
private static (string Actual, string Shown)[] CaptureFolders(string? captureData) =>
captureData is null ? [] : [(Path.Combine(captureData, "archive"), SampleArchiveDirectory), (captureData, SampleDataDirectory)];
/// <summary><paramref name="path"/> with its root <paramref name="from"/> replaced by <paramref name="to"/>; null when it is not under it.</summary>
private static string? Swap(string path, string from, string to)
{
if (string.IsNullOrEmpty(path)) return null;
var root = from.TrimEnd(Path.DirectorySeparatorChar);
if (path.TrimEnd(Path.DirectorySeparatorChar).Equals(root, StringComparison.OrdinalIgnoreCase)) return to;
return path.StartsWith(root + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase) ? to + path[root.Length..] : null;
}
/// <summary>Removes the temporary data folder of a capture environment (never a real one).</summary>
public void DeleteCaptureData()