namespace CursorLang.Core.Services; /// /// Where the background half of the application lives on disk. /// /// /// Two processes now share one folder, and each of them at some point needs the path /// of the other: the settings window registers the agent for startup and must not /// register itself, and the agent starts the settings window from the tray menu. /// Environment.ProcessPath answers the wrong question for both, so the paths /// are worked out from the folder the assemblies were loaded from. /// internal static class AgentExecutable { /// The background process — the one Windows starts at sign-in. internal const string AgentFileName = "CursorLang.exe"; /// The settings window, started on demand and gone when closed. internal const string SettingsFileName = "CursorLang.Settings.exe"; /// /// The full path of the agent, or null when it is not next to us — which /// happens in the tests and would happen to a half-copied installation. /// internal static string? AgentPath => Beside(AgentFileName); /// The full path of the settings window, on the same terms. internal static string? SettingsPath => Beside(SettingsFileName); private static string? Beside(string fileName) { string path = Path.Combine(AppContext.BaseDirectory, fileName); return File.Exists(path) ? path : null; } }