diff --git a/src/SourceGit/Native/Linux.cs b/src/SourceGit/Native/Linux.cs index a770abf5..852eee4b 100644 --- a/src/SourceGit/Native/Linux.cs +++ b/src/SourceGit/Native/Linux.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +using System; +using System.Diagnostics; using System.IO; using System.Runtime.Versioning; @@ -30,7 +31,15 @@ namespace SourceGit.Native public string FindVSCode() { - if (File.Exists("/usr/share/code/code")) return "/usr/share/code/code"; + var toolPath = "/usr/share/code/code"; + if (File.Exists(toolPath)) return toolPath; + return string.Empty; + } + + public string FindFleet() + { + var toolPath = $"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}/.local/share/JetBrains/Toolbox/apps/fleet/bin/Fleet"; + if (File.Exists(toolPath)) return toolPath; return string.Empty; } diff --git a/src/SourceGit/Native/MacOS.cs b/src/SourceGit/Native/MacOS.cs index b56ab1ff..006f7e8e 100644 --- a/src/SourceGit/Native/MacOS.cs +++ b/src/SourceGit/Native/MacOS.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +using System; +using System.Diagnostics; using System.IO; using System.Runtime.Versioning; using System.Text; @@ -27,11 +28,17 @@ namespace SourceGit.Native public string FindVSCode() { - if (File.Exists("/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code")) - { - return "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code"; - } - + var toolPath = "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code"; + if (File.Exists(toolPath)) + return toolPath; + return string.Empty; + } + + public string FindFleet() + { + var toolPath = $"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}/Applications/Fleet.app/Contents/MacOS/Fleet"; + if (File.Exists(toolPath)) + return toolPath; return string.Empty; } diff --git a/src/SourceGit/Native/OS.cs b/src/SourceGit/Native/OS.cs index 78f12972..2229ed18 100644 --- a/src/SourceGit/Native/OS.cs +++ b/src/SourceGit/Native/OS.cs @@ -13,6 +13,7 @@ namespace SourceGit.Native string FindGitExecutable(); string FindVSCode(); + string FindFleet(); void OpenTerminal(string workdir); void OpenInFileManager(string path, bool select); @@ -20,39 +21,33 @@ namespace SourceGit.Native void OpenWithDefaultEditor(string file); } - public static string GitInstallPath - { - get; - set; - } + public static string GitInstallPath { get; set; } - public static string VSCodeExecutableFile - { - get; - set; - } + public static string VSCodeExecutableFile { get; set; } + + public static string FleetExecutableFile { get; set; } static OS() { - if (OperatingSystem.IsMacOS()) - { - _backend = new MacOS(); - VSCodeExecutableFile = _backend.FindVSCode(); - } - else if (OperatingSystem.IsWindows()) + if (OperatingSystem.IsWindows()) { _backend = new Windows(); - VSCodeExecutableFile = _backend.FindVSCode(); + } + else if (OperatingSystem.IsMacOS()) + { + _backend = new MacOS(); } else if (OperatingSystem.IsLinux()) { _backend = new Linux(); - VSCodeExecutableFile = _backend.FindVSCode(); } else { throw new Exception("Platform unsupported!!!"); } + + VSCodeExecutableFile = _backend.FindVSCode(); + FleetExecutableFile = _backend.FindFleet(); } public static void SetupApp(AppBuilder builder) @@ -103,5 +98,22 @@ namespace SourceGit.Native } private static readonly IBackend _backend = null; + + public static void OpenInFleet(string repo) + { + if (string.IsNullOrEmpty(FleetExecutableFile)) + { + App.RaiseException(repo, "Fleet can NOT be found in your system!!!"); + return; + } + + Process.Start(new ProcessStartInfo() + { + WorkingDirectory = repo, + FileName = FleetExecutableFile, + Arguments = $"\"{repo}\"", + UseShellExecute = false, + }); + } } } \ No newline at end of file diff --git a/src/SourceGit/Native/Windows.cs b/src/SourceGit/Native/Windows.cs index d3dfc7c0..7ae2971d 100644 --- a/src/SourceGit/Native/Windows.cs +++ b/src/SourceGit/Native/Windows.cs @@ -116,30 +116,21 @@ namespace SourceGit.Native Microsoft.Win32.RegistryHive.LocalMachine, Environment.Is64BitOperatingSystem ? Microsoft.Win32.RegistryView.Registry64 : Microsoft.Win32.RegistryView.Registry32); - var vscode = root.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C26E74D1-022E-4238-8B9D-1E7564A36CC9}_is1"); + var vscode = root.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{EA457B21-F73E-494C-ACAB-524FDE069978}_is1"); if (vscode != null) { return vscode.GetValue("DisplayIcon") as string; } - vscode = root.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1287CAD5-7C8D-410D-88B9-0D1EE4A83FF2}_is1"); - if (vscode != null) - { - return vscode.GetValue("DisplayIcon") as string; - } - - vscode = root.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{F8A2A208-72B3-4D61-95FC-8A65D340689B}_is1"); - if (vscode != null) - { - return vscode.GetValue("DisplayIcon") as string; - } - - vscode = root.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{EA457B21-F73E-494C-ACAB-524FDE069978}_is1"); - if (vscode != null) - { - return vscode.GetValue("DisplayIcon") as string; - } + var toolPath = Environment.ExpandEnvironmentVariables($"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe"); + if (File.Exists(toolPath)) return toolPath; + return string.Empty; + } + public string FindFleet() + { + var toolPath = Environment.ExpandEnvironmentVariables($"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}\\AppData\\Local\\Programs\\Fleet\\Fleet.exe"); + if (File.Exists(toolPath)) return toolPath; return string.Empty; } diff --git a/src/SourceGit/Resources/ExternalToolIcons/fleet.png b/src/SourceGit/Resources/ExternalToolIcons/fleet.png new file mode 100644 index 00000000..85e2fab0 Binary files /dev/null and b/src/SourceGit/Resources/ExternalToolIcons/fleet.png differ diff --git a/src/SourceGit/Resources/ExternalToolIcons/vscode.png b/src/SourceGit/Resources/ExternalToolIcons/vscode.png new file mode 100644 index 00000000..1ee79ae1 Binary files /dev/null and b/src/SourceGit/Resources/ExternalToolIcons/vscode.png differ diff --git a/src/SourceGit/Resources/Icons.axaml b/src/SourceGit/Resources/Icons.axaml index 6b2c3217..20b605f2 100644 --- a/src/SourceGit/Resources/Icons.axaml +++ b/src/SourceGit/Resources/Icons.axaml @@ -80,7 +80,6 @@ M520 168C291 168 95 311 16 512c79 201 275 344 504 344 229 0 425-143 504-344-79-201-275-344-504-344zm0 573c-126 0-229-103-229-229s103-229 229-229c126 0 229 103 229 229s-103 229-229 229zm0-367c-76 0-137 62-137 137s62 137 137 137S657 588 657 512s-62-137-137-137z M734 128c-33-19-74-8-93 25l-41 70c-28-6-58-9-90-9-294 0-445 298-445 298s82 149 231 236l-31 54c-19 33-8 74 25 93 33 19 74 8 93-25L759 222C778 189 767 147 734 128zM305 512c0-115 93-208 207-208 14 0 27 1 40 4l-37 64c-1 0-2 0-2 0-77 0-140 63-140 140 0 26 7 51 20 71l-37 64C324 611 305 564 305 512zM771 301 700 423c13 27 20 57 20 89 0 110-84 200-192 208l-51 89c12 1 24 2 36 2 292 0 446-298 446-298S895 388 771 301z M469 235V107h85v128h-85zm-162-94 85 85-60 60-85-85 60-60zm469 60-85 85-60-60 85-85 60 60zm-549 183A85 85 0 01302 341H722a85 85 0 0174 42l131 225A85 85 0 01939 652V832a85 85 0 01-85 85H171a85 85 0 01-85-85v-180a85 85 0 0112-43l131-225zM722 427H302l-100 171h255l10 29a59 59 0 002 5c2 4 5 9 9 14 8 9 18 17 34 17 16 0 26-7 34-17a72 72 0 0011-18l0-0 10-29h255l-100-171zM853 683H624a155 155 0 01-12 17C593 722 560 747 512 747c-48 0-81-25-99-47a155 155 0 01-12-17H171v149h683v-149z - M719 85 388 417l-209-165L87 299v427l92 47 210-164L720 939 939 850V171zM186 610V412l104 104zm526 55L514 512l198-153z M447 561a26 26 0 0126 26v171H421v-171a26 26 0 0126-26zm-98 65a26 26 0 0126 26v104H323v-104a26 26 0 0126-26zm0 0M561 268a32 32 0 0132 30v457h-65V299a32 32 0 0132-32zm0 0M675 384a26 26 0 0126 26v348H649v-350a26 26 0 0126-24zm0 0M801 223v579H223V223h579M805 171H219A49 49 0 00171 219v585A49 49 0 00219 853h585A49 49 0 00853 805V219A49 49 0 00805 171z M512 0C229.216 0 0 229.216 0 512c0 282.752 229.216 512 512 512s512-229.248 512-512c0-282.784-229.216-512-512-512z m0 957.92C266.112 957.92 66.08 757.888 66.08 512S266.112 66.08 512 66.08 957.92 266.112 957.92 512 757.888 957.92 512 957.92zM192 416h96a32 32 0 0 0 32-32v-32a32 32 0 0 0-32-32H192a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32zM384 416h96a32 32 0 0 0 32-32v-32a32 32 0 0 0-32-32h-96a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32zM576 416h96a32 32 0 0 0 32-32v-32a32 32 0 0 0-32-32h-96a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32zM832 320h-64a32 32 0 0 0-32 32v128h-160a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32h256a32 32 0 0 0 32-32v-192a32 32 0 0 0-32-32zM320 544v-32a32 32 0 0 0-32-32H192a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32h96a32 32 0 0 0 32-32zM384 576h96a32 32 0 0 0 32-32v-32a32 32 0 0 0-32-32h-96a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32zM800 640H256a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32h544a32 32 0 0 0 32-32v-32a32 32 0 0 0-32-32z M875 117H149C109 117 75 151 75 192v640c0 41 34 75 75 75h725c41 0 75-34 75-75V192c0-41-34-75-75-75zM139 832V192c0-6 4-11 11-11h331v661H149c-6 0-11-4-11-11zm747 0c0 6-4 11-11 11H544v-661H875c6 0 11 4 11 11v640z diff --git a/src/SourceGit/Resources/Locales.Designer.cs b/src/SourceGit/Resources/Locales.Designer.cs index ba492504..eda36811 100644 --- a/src/SourceGit/Resources/Locales.Designer.cs +++ b/src/SourceGit/Resources/Locales.Designer.cs @@ -1,7 +1,6 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -2967,6 +2966,15 @@ namespace SourceGit.Resources { } } + /// + /// Looks up a localized string similar to Open In Fleet. + /// + public static string Text_Repository_Fleet { + get { + return ResourceManager.GetString("Text.Repository.Fleet", resourceCulture); + } + } + /// /// Looks up a localized string similar to LOCAL BRANCHES. /// @@ -2985,6 +2993,15 @@ namespace SourceGit.Resources { } } + /// + /// Looks up a localized string similar to Open in. + /// + public static string Text_Repository_OpenWith { + get { + return ResourceManager.GetString("Text.Repository.OpenWith", resourceCulture); + } + } + /// /// Looks up a localized string similar to Refresh. /// diff --git a/src/SourceGit/Resources/Locales.en.resx b/src/SourceGit/Resources/Locales.en.resx index 2f9e7bdd..884665b7 100644 --- a/src/SourceGit/Resources/Locales.en.resx +++ b/src/SourceGit/Resources/Locales.en.resx @@ -342,6 +342,9 @@ Open In Visual Studio Code + + Open In Fleet + Open In Git Bash @@ -1302,6 +1305,9 @@ APPEARANCE + + Open in + Software Update diff --git a/src/SourceGit/Resources/Locales.resx b/src/SourceGit/Resources/Locales.resx index 8e06cd4d..cb640c72 100644 --- a/src/SourceGit/Resources/Locales.resx +++ b/src/SourceGit/Resources/Locales.resx @@ -342,6 +342,9 @@ Open In Visual Studio Code + + Open In Fleet + Open In Git Bash @@ -1302,6 +1305,9 @@ Appearance + + Open in + Software Update diff --git a/src/SourceGit/SourceGit.csproj b/src/SourceGit/SourceGit.csproj index 0edbbb2f..8a1b5a45 100644 --- a/src/SourceGit/SourceGit.csproj +++ b/src/SourceGit/SourceGit.csproj @@ -23,6 +23,7 @@ + diff --git a/src/SourceGit/ViewModels/Repository.cs b/src/SourceGit/ViewModels/Repository.cs index ee684ee3..f8c25987 100644 --- a/src/SourceGit/ViewModels/Repository.cs +++ b/src/SourceGit/ViewModels/Repository.cs @@ -49,12 +49,6 @@ namespace SourceGit.ViewModels set; } = new AvaloniaList(); - [JsonIgnore] - public bool IsVSCodeFound - { - get => !string.IsNullOrEmpty(Native.OS.VSCodeExecutableFile); - } - [JsonIgnore] public Models.GitFlow GitFlow { @@ -286,6 +280,11 @@ namespace SourceGit.ViewModels Native.OS.OpenInVSCode(_fullpath); } + public void OpenInFleet() + { + Native.OS.OpenInFleet(_fullpath); + } + public void OpenInTerminal() { Native.OS.OpenTerminal(_fullpath); diff --git a/src/SourceGit/Views/Repository.axaml b/src/SourceGit/Views/Repository.axaml index 9759ba00..6632d5c7 100644 --- a/src/SourceGit/Views/Repository.axaml +++ b/src/SourceGit/Views/Repository.axaml @@ -17,21 +17,34 @@ - - - + + @@ -70,7 +83,7 @@ - - @@ -217,22 +230,22 @@ - + - + - - @@ -288,10 +301,10 @@ - @@ -305,10 +318,10 @@ -