refactor(ui): dedupe path-open helper across five view models

ListsIslandViewModel.OpenInExplorer, MergeSectionViewModel.OpenWorktree,
WorktreesOverviewModalViewModel.OpenInExplorer, AboutModalViewModel.OpenPath and
TasksIslandViewModel.OpenTaskWorktree each reimplemented "open this path in the
shell" with their own existence check, launch mechanism and error handling.
Replace all five with the new ShellOpen.Path helper and route failures through
the existing ErrorReported -> footer-strip convention instead of bare catch {}.
This commit is contained in:
Mika Kuns
2026-08-24 09:38:41 +02:00
parent d309302043
commit b2a1b79029
11 changed files with 223 additions and 48 deletions
@@ -1432,16 +1432,9 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
[RelayCommand]
private void OpenTaskWorktree(TaskRowViewModel? row)
{
if (row?.WorktreePath is not { } path || string.IsNullOrWhiteSpace(path)) return;
try
{
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
{
FileName = path,
UseShellExecute = true,
});
}
catch (Exception ex) { ErrorReported?.Invoke(Loc.T("vm.tasksIsland.openWorktreeFailed", ex.Message)); }
var (ok, error) = ShellOpen.Path(row?.WorktreePath);
if (!ok && error is not null)
ErrorReported?.Invoke(Loc.T("vm.tasksIsland.openWorktreeFailed", error));
}
[RelayCommand]