Forge
csharp4405de34
1using System.Diagnostics;
2
3namespace CascadeIDE.Features.Workspace.Application;
4
5/// <summary>Открыть путь в проводнике Windows (ADR 0167 §2.7).</summary>
6public static class WindowsShellReveal
7{
8 public static bool TryRevealInExplorer(string? path)
9 {
10 if (string.IsNullOrWhiteSpace(path))
11 return false;
12
13 try
14 {
15 var full = Path.GetFullPath(path.Trim());
16 if (!File.Exists(full) && !Directory.Exists(full))
17 return false;
18
19 var argument = File.Exists(full)
20 ? $"/select,\"{full}\""
21 : $"\"{full}\"";
22
23 using var process = Process.Start(new ProcessStartInfo
24 {
25 FileName = "explorer.exe",
26 Arguments = argument,
27 UseShellExecute = true,
28 });
29 return process is not null;
30 }
31 catch
32 {
33 return false;
34 }
35 }
36}
37
View only · write via MCP/CIDE