@@ -148,10 +148,28 @@ private async void DolphinExeBrowse_OnClick(object sender, RoutedEventArgs e)
148148
149149 if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
150150 {
151- if ( IsFlatpakDolphinInstalled ( ) && DolphinExeInput . Text == "" )
151+ // Made this more extensible for future support for e.g. snap
152+ var dolphinPaths = new ( Func < bool > IsInstalled , string Path ) [ ]
152153 {
153- DolphinExeInput . Text = "flatpak run org.DolphinEmu.dolphin-emu" ;
154- return ;
154+ ( IsFlatpakDolphinInstalled , "flatpak run org.DolphinEmu.dolphin-emu" ) ,
155+ ( IsNativeDolphinInstalled , "dolphin-emu" ) ,
156+ } ;
157+
158+ foreach ( var ( isInstalled , path ) in dolphinPaths )
159+ {
160+ if ( isInstalled ( ) )
161+ {
162+ var result = await new YesNoWindow ( )
163+ . SetMainText ( t ( "question.dolphin_found.title" ) )
164+ . SetExtraText ( $ "{ t ( "question.dolphin_found.extra" ) } \n { path } ")
165+ . AwaitAnswer ( ) ;
166+
167+ if ( result )
168+ {
169+ DolphinExeInput . Text = path ;
170+ return ;
171+ }
172+ }
155173 }
156174
157175 if ( ! EnvHelper . IsFlatpakSandboxed ( ) && ! IsFlatpakDolphinInstalled ( ) )
@@ -249,6 +267,11 @@ private bool IsFlatpakDolphinInstalled()
249267 return LinuxDolphinInstallerService . IsDolphinInstalledInFlatpak ( ) ;
250268 }
251269
270+ private bool IsNativeDolphinInstalled ( )
271+ {
272+ return LinuxDolphinInstallerService . IsDolphinInstalledNative ( ) ;
273+ }
274+
252275 private async void GameLocationBrowse_OnClick ( object sender , RoutedEventArgs e )
253276 {
254277 var fileType = new FilePickerFileType ( "Game files" ) { Patterns = [ "*.iso" , "*.wbfs" , "*.rvz" ] } ;
@@ -262,8 +285,13 @@ private async void GameLocationBrowse_OnClick(object sender, RoutedEventArgs e)
262285
263286 private async void DolphinUserPathBrowse_OnClick ( object sender , RoutedEventArgs e )
264287 {
265- // Attempt to find Dolphin's default path if no valid folder is set
266- var folderPath = PathManager . TryFindUserFolderPath ( ) ;
288+ // Detect Data folder based on the Dolphin path currently in the input field
289+ // (which may have been edited but not yet saved)
290+ var currentDolphinPath = DolphinExeInput . Text ;
291+ var folderPath = string . IsNullOrWhiteSpace ( currentDolphinPath )
292+ ? PathManager . TryFindUserFolderPath ( )
293+ : PathManager . TryFindUserFolderPath ( currentDolphinPath ) ;
294+
267295 if ( ! string . IsNullOrEmpty ( folderPath ) )
268296 {
269297 // Ask the user if they want to use the automatically found folder
0 commit comments