示例#1
0
        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());
        }
示例#2
0
        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);
            }
        }
示例#3
0
 protected override InstallStatus CheckStatus()
 {
     return(ApplicationPaths.SublimeTextPath().HasValue ? InstallStatus.Installed : InstallStatus.NotInstalled);
 }