- Moderator
- #1
Hi
In earlier versions before the plugins were moved, I used this code to find the installpath. How do I find the ProgramData path instead? Both for Vista and XP....

In earlier versions before the plugins were moved, I used this code to find the installpath. How do I find the ProgramData path instead? Both for Vista and XP....
Code:
private string GetMediaPortalPath()
{
string sRegRoot = "SOFTWARE";
if (IntPtr.Size > 4)
sRegRoot += "\\Wow6432Node";
RegistryKey MediaPortalKey = Registry.LocalMachine.OpenSubKey(sRegRoot + "\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MediaPortal\\", true);
if (MediaPortalKey != null)
{
return MediaPortalKey.GetValue("InstallPath").ToString();
}
else
{
MediaPortalKey = MediaPortalKey.OpenSubKey(sRegRoot + "\\Team MediaPortal\\MediaPortal\\", true);
if (MediaPortalKey != null)
{
return MediaPortalKey.GetValue("ApplicationDir").ToString();
}
else
return null;
}
}