@@ -120,6 +120,12 @@ function getReadablePath(path: string) {
120120 }
121121}
122122
123+ declare global {
124+ interface Window {
125+ desktopApi ?: { selectApplication : ( ) => Promise < string | undefined > } ;
126+ }
127+ }
128+
123129@inject ( 'uiStore' )
124130@observer
125131class ElectronConfig extends React . Component < {
@@ -141,7 +147,13 @@ class ElectronConfig extends React.Component<{
141147 }
142148
143149 selectApplication = async ( ) => {
144- const pathToApplication = await uploadFile ( 'path' ) ;
150+ const useNativePicker = window . desktopApi ?. selectApplication ;
151+
152+ const pathToApplication = await (
153+ useNativePicker
154+ ? window . desktopApi ?. selectApplication ( )
155+ : uploadFile ( 'path' )
156+ ) ;
145157
146158 if ( ! pathToApplication ) {
147159 this . props . closeSelf ( ) ;
@@ -182,9 +194,9 @@ class ElectronConfig extends React.Component<{
182194 </ p >
183195 {
184196 platform === 'mac' && previousElectronAppPaths . length < 2 && < p >
185- For .app bundles, enter either the bundle name (with or without .app)
186- or the full path to the executable itself, typically stored in
187- Contents/MacOS inside the bundle.
197+ For .app bundles, you can intercept either the bundle
198+ ( the .app directory) or the executable itself,
199+ typically stored in Contents/MacOS inside the bundle.
188200 </ p >
189201 }
190202 < p >
@@ -220,4 +232,4 @@ export const ElectronCustomUi = {
220232 columnWidth : 1 ,
221233 rowHeight : 2 ,
222234 configComponent : ElectronConfig
223- } ;
235+ } ;
0 commit comments