mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 22:56:25 +00:00
add api to check if spotify is installed (#193)
This commit is contained in:
parent
a70bc5fc09
commit
26b5f8054d
@ -302,6 +302,31 @@ namespace SpotifyAPI.Local
|
||||
return Process.GetProcessesByName("spotifywebhelper").Length >= 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether [spotify is installed].
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// <c>true</c> if [spotify is installed]; otherwise, <c>false</c>.
|
||||
/// </returns>
|
||||
public static bool IsSpotifyInstalled()
|
||||
{
|
||||
bool isInstalled = false;
|
||||
|
||||
// Checks if UWP Spotify is installed.
|
||||
string uwpSpotifyPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Packages\SpotifyAB.SpotifyMusic_zpdnekdrzrea0");
|
||||
|
||||
isInstalled = Directory.Exists(uwpSpotifyPath);
|
||||
|
||||
// If UWP Spotify is not installed, try look for desktop version
|
||||
if (!isInstalled)
|
||||
{
|
||||
string desktopSpotifyPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"Spotify\Spotify.exe");
|
||||
isInstalled = File.Exists(desktopSpotifyPath);
|
||||
}
|
||||
|
||||
return isInstalled;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs Spotify
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user