From fd2160e56e54447f83f178cd2f335148c5fd59c2 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 23 Apr 2024 16:52:55 +0800 Subject: [PATCH] feature: supports JetBrains Rider (#77) --- README.md | 3 ++- src/Models/ExternalTool.cs | 5 +++++ src/Native/Linux.cs | 1 + src/Native/MacOS.cs | 1 + src/Native/Windows.cs | 17 +++++++++++++++++ src/Resources/ExternalToolIcons/rider.png | Bin 0 -> 2141 bytes 6 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/Resources/ExternalToolIcons/rider.png diff --git a/README.md b/README.md index 4ccde98f..d759ef6b 100644 --- a/README.md +++ b/README.md @@ -62,9 +62,10 @@ This app supports open repository in external tools listed in the table below. | Visual Studio Code | YES | YES | YES | VSCODE_PATH | | Visual Studio Code - Insiders | YES | YES | YES | VSCODE_INSIDERS_PATH | | JetBrains Fleet | YES | YES | YES | FLEET_PATH | +| JetBrains Rider | YES | YES | YES | RIDER_PATH | | Sublime Text | YES | YES | YES | SUBLIME_TEXT_PATH | -You can set the given environment variable for special tool if it can NOT be found by this app automatically. +> You can set the given environment variable for special tool if it can NOT be found by this app automatically. ## Screenshots diff --git a/src/Models/ExternalTool.cs b/src/Models/ExternalTool.cs index cb50df58..bca67fc1 100644 --- a/src/Models/ExternalTool.cs +++ b/src/Models/ExternalTool.cs @@ -59,6 +59,11 @@ namespace SourceGit.Models TryAdd("JetBrains Fleet", "fleet", "\"{0}\"", "FLEET_PATH", platform_finder); } + public void Rider(Func platform_finder) + { + TryAdd("JetBrains Rider", "rider", "\"{0}\"", "RIDER_PATH", platform_finder); + } + public void SublimeText(Func platform_finder) { TryAdd("Sublime Text", "sublime_text", "\"{0}\"", "SUBLIME_TEXT_PATH", platform_finder); diff --git a/src/Native/Linux.cs b/src/Native/Linux.cs index 176941cc..1d3f750b 100644 --- a/src/Native/Linux.cs +++ b/src/Native/Linux.cs @@ -58,6 +58,7 @@ namespace SourceGit.Native finder.VSCode(() => FindExecutable("code")); finder.VSCodeInsiders(() => FindExecutable("code-insiders")); finder.Fleet(FindJetBrainFleet); + finder.Rider(() => string.Empty); finder.SublimeText(() => FindExecutable("subl")); return finder.Founded; } diff --git a/src/Native/MacOS.cs b/src/Native/MacOS.cs index f4ddc2ea..6d6e8759 100644 --- a/src/Native/MacOS.cs +++ b/src/Native/MacOS.cs @@ -33,6 +33,7 @@ namespace SourceGit.Native finder.VSCode(() => "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code"); finder.VSCodeInsiders(() => "/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/bin/code"); finder.Fleet(() => $"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}/Applications/Fleet.app/Contents/MacOS/Fleet"); + finder.Rider(() => string.Empty); finder.SublimeText(() => "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"); return finder.Founded; } diff --git a/src/Native/Windows.cs b/src/Native/Windows.cs index 2d22ac42..9325cea7 100644 --- a/src/Native/Windows.cs +++ b/src/Native/Windows.cs @@ -111,6 +111,7 @@ namespace SourceGit.Native finder.VSCode(FindVSCode); finder.VSCodeInsiders(FindVSCodeInsiders); finder.Fleet(() => $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\Programs\\Fleet\\Fleet.exe"); + finder.Rider(FindRider); finder.SublimeText(FindSublimeText); return finder.Founded; } @@ -322,6 +323,22 @@ namespace SourceGit.Native return string.Empty; } + private string FindRider() + { + var rider = Environment.GetEnvironmentVariable("JetBrains Rider"); + if (!string.IsNullOrEmpty(rider)) + { + rider = rider.TrimEnd(';', ' '); + var path = Path.Combine(rider, "rider64.exe"); + if (File.Exists(path)) + { + return path; + } + } + + return string.Empty; + } + private string FindSublimeText() { var localMachine = Microsoft.Win32.RegistryKey.OpenBaseKey( diff --git a/src/Resources/ExternalToolIcons/rider.png b/src/Resources/ExternalToolIcons/rider.png new file mode 100644 index 0000000000000000000000000000000000000000..6ab3b8cbf80207a8f57fd8ea27befa92dadf0960 GIT binary patch literal 2141 zcmV-j2%`6iP)E-tQiFhkHW3A>JPHK`r2$%LDaAha&Ny@T z{l0g*-EIpfneNQ(y?f_;^PMy2oLPb>5cVCC(2nL3IUjKZT0U%Z#JK`3AvX7zAIEUhhAP5Xu z`T}T#L`-ku{ z6Cvz{1?HV4=5}gLE5Cyv!1g4rm2LUK_SIENK zdRvQ%yy9zpCLrPAk}S5?UFU}lfZli+DIo#So3&!yolmC$JvnAK8Hp6N+=&NP7gs2A3p5p3q`cbjT<*GWy%yZG&HDVVM-Yp865?{ zh&rS>%#=O-dIDtgPp}x~_*L3<9E#CpInA!Fu1?ppH*elVSy`DaKO>kqb7lv9AVDiN zXE{y4U@GLv%V6zsyMGbh+I5A*csF9RPx8tl?<=t? z077{i2red|NF;cQsttsD_wHf-{Q1^6f^S`m7cW-(!t1YIy;==&LXlCUMmhS`)zumR zaHi50CZj=l+^RgaGN27|wlfgYT(PlT3m_tb6H%XNA|9}tg8*aJtXUx`pOTWIZlS75 zoISgD?+yZhdu8cgOM=P((VA%=+^3ukme>K`m*)2J06-%M8byGyV#Nx_c*BMbh>MHU zrF>di8V(&gg!uS)b-ZuiK3uzYEjR;g^HvliYTKW(Dz5agg1|qUXspy|jL)$9038(? zeIkMw5#8nH=BlCWnl)>%eED*p_vYl}VBNZPYTs-&BRe}AK|r)xIwl{PTjCv}b` z=a^jC6V>TH+ZM0R^GA6&uCrvm`p#8%Fo24_`S{v5*XGJT_s}rWziTQ!5}HUK)F|ny z?K>2wULa)ot_pW|5V+Y^@r+l{-n!Cu5R57t9DQa=eq-CVI5}W6)eS+gC^CLy&sm+H zgYF(?U}rFn5LvROxVjtpfKz0c>g_%4-j^9z zcvdKDaVp&jge&}1-^13u*Z}WC|KFz>FO(&1QmRiUg THAg)l00000NkvXXu0mjfYd`9U literal 0 HcmV?d00001