Browse Source

Detect Mono using current user's registry.

pull/42/merge
Matt Ward 12 years ago
parent
commit
cf49e04ea6
  1. 11
      samples/Mono/Mono.Build.Tasks/MonoToolLocationHelper.cs

11
samples/Mono/Mono.Build.Tasks/MonoToolLocationHelper.cs

@ -200,7 +200,7 @@ namespace Mono.Build.Tasks @@ -200,7 +200,7 @@ namespace Mono.Build.Tasks
static string ReadRegistryValue(string keyName, string name)
{
try {
RegistryKey key = Registry.LocalMachine.OpenSubKey(keyName);
RegistryKey key = OpenLocalMachineOrUserRegistryKey(keyName);
if (key != null) {
string readValue = (string)key.GetValue(name);
key.Close();
@ -212,5 +212,14 @@ namespace Mono.Build.Tasks @@ -212,5 +212,14 @@ namespace Mono.Build.Tasks
return String.Empty;
}
static RegistryKey OpenLocalMachineOrUserRegistryKey(string keyName)
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(keyName);
if (key != null) {
return key;
}
return Registry.LocalMachine.OpenSubKey(keyName);
}
}
}

Loading…
Cancel
Save