@@ -49,13 +49,14 @@ public string FindTerminal(Models.ShellOrTerminal shell)
49
49
public List < Models . ExternalTool > FindExternalTools ( )
50
50
{
51
51
var finder = new Models . ExternalToolsFinder ( ) ;
52
- finder . VSCode ( ( ) => FindExecutable ( "code" ) ) ;
53
- finder . VSCodeInsiders ( ( ) => FindExecutable ( "code-insiders" ) ) ;
54
- finder . VSCodium ( ( ) => FindExecutable ( "codium" ) ) ;
52
+ finder . VSCode ( ( ) => FindExecutable ( "code" , "com.visualstudio.code" ) ) ;
53
+ finder . VSCodeInsiders ( ( ) => FindExecutable ( "code-insiders" , "com.vscodium.codium-insiders" ) ) ;
54
+ finder . VSCodium ( ( ) => FindExecutable ( "codium" , "com.vscodium.codium" ) ) ;
55
55
finder . Fleet ( FindJetBrainsFleet ) ;
56
56
finder . FindJetBrainsFromToolbox ( ( ) => $ "{ Environment . GetFolderPath ( Environment . SpecialFolder . LocalApplicationData ) } /JetBrains/Toolbox") ;
57
- finder . SublimeText ( ( ) => FindExecutable ( "subl" ) ) ;
58
- finder . Zed ( ( ) => FindExecutable ( "zeditor" ) ) ;
57
+ FindJetBrainsFromFlatpak ( finder ) ;
58
+ finder . SublimeText ( ( ) => FindExecutable ( "subl" , "com.sublimetext.three" ) ) ;
59
+ finder . Zed ( ( ) => FindExecutable ( "zeditor" , "dev.zed.Zed" ) ) ;
59
60
return finder . Founded ;
60
61
}
61
62
@@ -117,7 +118,7 @@ public void OpenWithDefaultEditor(string file)
117
118
}
118
119
}
119
120
120
- private string FindExecutable ( string filename )
121
+ private string FindExecutable ( string filename , string flatpakAppId = null )
121
122
{
122
123
var pathVariable = Environment . GetEnvironmentVariable ( "PATH" ) ?? string . Empty ;
123
124
var paths = pathVariable . Split ( Path . PathSeparator , StringSplitOptions . RemoveEmptyEntries ) ;
@@ -128,6 +129,17 @@ private string FindExecutable(string filename)
128
129
return test ;
129
130
}
130
131
132
+ if ( flatpakAppId != null )
133
+ {
134
+ var userBin = Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . LocalApplicationData ) , "flatpak/exports/bin" ) ;
135
+ foreach ( var path in new [ ] { "/var/lib/flatpak/exports/bin" , userBin } )
136
+ {
137
+ var test = Path . Combine ( path , flatpakAppId ) ;
138
+ if ( File . Exists ( test ) )
139
+ return test ;
140
+ }
141
+ }
142
+
131
143
return string . Empty ;
132
144
}
133
145
@@ -136,5 +148,33 @@ private string FindJetBrainsFleet()
136
148
var path = $ "{ Environment . GetFolderPath ( Environment . SpecialFolder . LocalApplicationData ) } /JetBrains/Toolbox/apps/fleet/bin/Fleet";
137
149
return File . Exists ( path ) ? path : FindExecutable ( "fleet" ) ;
138
150
}
151
+
152
+ private static void FindJetBrainsFromFlatpak ( Models . ExternalToolsFinder finder )
153
+ {
154
+ var userBin = Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . LocalApplicationData ) , "flatpak/exports/bin" ) ;
155
+ foreach ( var path in new [ ] { "/var/lib/flatpak/exports/bin" , userBin } )
156
+ {
157
+ if ( Directory . Exists ( path ) )
158
+ {
159
+ foreach ( var file in Directory . GetFiles ( path , "com.jetbrains.*" ) )
160
+ {
161
+ var fileName = Path . GetFileName ( file ) ;
162
+ var appName = fileName [ 14 ..] . Replace ( "-" , " " ) ;
163
+ var icon = new string ( Array . FindAll ( fileName . ToCharArray ( ) , char . IsUpper ) ) ;
164
+ if ( icon . Length > 2 )
165
+ icon = icon [ ..2 ] ;
166
+ icon = icon switch
167
+ {
168
+ "DG" => "DB" , // DataGrip
169
+ "GL" => "GO" , // GoLand
170
+ "IJ" => "JB" , // IntelliJ
171
+ "R" => "RD" , // Rider
172
+ _ => icon
173
+ } ;
174
+ finder . Founded . Add ( new Models . ExternalTool ( appName , "JetBrains/" + icon , file ) ) ;
175
+ }
176
+ }
177
+ }
178
+ }
139
179
}
140
180
}
0 commit comments