File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -302,6 +302,31 @@ public static Boolean IsSpotifyWebHelperRunning()
302302 return Process . GetProcessesByName ( "spotifywebhelper" ) . Length >= 1 ;
303303 }
304304
305+ /// <summary>
306+ /// Determines whether [spotify is installed].
307+ /// </summary>
308+ /// <returns>
309+ /// <c>true</c> if [spotify is installed]; otherwise, <c>false</c>.
310+ /// </returns>
311+ public static bool IsSpotifyInstalled ( )
312+ {
313+ bool isInstalled = false ;
314+
315+ // Checks if UWP Spotify is installed.
316+ string uwpSpotifyPath = Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . LocalApplicationData ) , @"Packages\SpotifyAB.SpotifyMusic_zpdnekdrzrea0" ) ;
317+
318+ isInstalled = Directory . Exists ( uwpSpotifyPath ) ;
319+
320+ // If UWP Spotify is not installed, try look for desktop version
321+ if ( ! isInstalled )
322+ {
323+ string desktopSpotifyPath = Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . ApplicationData ) , @"Spotify\Spotify.exe" ) ;
324+ isInstalled = File . Exists ( desktopSpotifyPath ) ;
325+ }
326+
327+ return isInstalled ;
328+ }
329+
305330 /// <summary>
306331 /// Runs Spotify
307332 /// </summary>
You can’t perform that action at this time.
0 commit comments