public static Menu CreateMenu(IObservable <Optional <AbsoluteFilePath> > path) { var sublimeTextPath = ApplicationPaths.SublimeTextPath(); return(path .SelectPerElement(project => project.ContainingDirectory) .Select(dir => new [] { Menu.Item( name: "Open in Sublime", command: Command.Create( isEnabled: dir.HasValue && sublimeTextPath.HasValue, action: () => Task.Run(() => { if (Platform.OperatingSystem == OS.Mac) { ExternalApplication.FromAppBundle(sublimeTextPath.Value).Open(dir.Value); } else { var ps = new ProcessStartInfo() { FileName = (sublimeTextPath.Value / new FileName("sublime_text.exe")).NativePath, Arguments = "\"" + dir.Value.NativePath + "\"", UseShellExecute = false }; ps.UpdatePathEnvironment(); Process.Start(ps); } }))), }) .Concat()); }
public void Sublime_ManualTest() { var path = ApplicationPaths.SublimeTextPath(); if (Platform.OperatingSystem == OS.Windows) { Assert.AreEqual(@"C:\Program Files\Sublime Text 3", path.Value.NativePath); } else { Assert.AreEqual(@"TODO", path.Value.NativePath); } }
protected override InstallStatus CheckStatus() { return(ApplicationPaths.SublimeTextPath().HasValue ? InstallStatus.Installed : InstallStatus.NotInstalled); }