@@ -14,9 +14,9 @@ namespace VisualRust.Shared
14
14
public class Environment
15
15
{
16
16
private const string InnoPath = @"Software\Microsoft\Windows\CurrentVersion\Uninstall\Rust_is1" ;
17
- private const string MozillaPath = @"Software\Mozilla Foundation" ;
17
+ private static readonly string [ ] MozillaPaths = { @"Software\Mozilla Foundation" , @"Software\The Rust Project Developers" } ;
18
18
private const string install = "InstallLocation" ;
19
-
19
+
20
20
public const string DefaultTarget = "default" ;
21
21
22
22
public static string FindInstallPath ( string target )
@@ -49,7 +49,7 @@ public static IEnumerable<string> FindCurrentUserInstallPaths()
49
49
50
50
public static TargetTriple GetTarget ( string exePath )
51
51
{
52
- if ( ! File . Exists ( exePath ) )
52
+ if ( ! File . Exists ( exePath ) )
53
53
return null ;
54
54
ProcessStartInfo psi = new ProcessStartInfo
55
55
{
@@ -65,7 +65,7 @@ public static TargetTriple GetTarget(string exePath)
65
65
Process proc = Process . Start ( psi ) ;
66
66
verboseVersion = proc . StandardOutput . ReadToEnd ( ) ;
67
67
}
68
- catch ( Win32Exception )
68
+ catch ( Win32Exception )
69
69
{
70
70
return null ;
71
71
}
@@ -102,7 +102,7 @@ private static IEnumerable<string> GetAllInstallPaths()
102
102
static string GetMultirustInstallRoot ( )
103
103
{
104
104
string multirustHome = System . Environment . GetEnvironmentVariable ( "MULTIRUST_HOME" ) ;
105
- if ( String . IsNullOrEmpty ( multirustHome ) )
105
+ if ( String . IsNullOrEmpty ( multirustHome ) )
106
106
{
107
107
string localAppData = System . Environment . GetFolderPath ( System . Environment . SpecialFolder . LocalApplicationData ) ;
108
108
return Path . Combine ( localAppData , ".multirust" ) ;
@@ -123,15 +123,20 @@ private static string[] GetInnoInstallRoot()
123
123
124
124
private static IEnumerable < string > GetInstallRoots ( RegistryHive hive , RegistryView view )
125
125
{
126
- RegistryKey mozillaKey = RegistryKey . OpenBaseKey ( hive , view ) . OpenSubKey ( MozillaPath ) ;
127
- if ( mozillaKey == null )
128
- return new string [ 0 ] ;
129
- return mozillaKey
130
- . GetSubKeyNames ( )
131
- . Where ( n => n . StartsWith ( "Rust" , StringComparison . OrdinalIgnoreCase ) )
132
- . SelectMany ( n => AllSubKeys ( mozillaKey . OpenSubKey ( n ) ) )
133
- . Select ( k => k . GetValue ( "InstallDir" ) as string )
134
- . Where ( x => x != null ) ;
126
+ foreach ( string root in MozillaPaths )
127
+ {
128
+ RegistryKey mozillaKey = RegistryKey . OpenBaseKey ( hive , view ) . OpenSubKey ( root ) ;
129
+ if ( mozillaKey == null )
130
+ continue ;
131
+ var paths = mozillaKey
132
+ . GetSubKeyNames ( )
133
+ . Where ( n => n . StartsWith ( "Rust" , StringComparison . OrdinalIgnoreCase ) )
134
+ . SelectMany ( n => AllSubKeys ( mozillaKey . OpenSubKey ( n ) ) )
135
+ . Select ( k => k . GetValue ( "InstallDir" ) as string )
136
+ . Where ( x => x != null ) ;
137
+ foreach ( string path in paths )
138
+ yield return path ;
139
+ }
135
140
}
136
141
137
142
private static IEnumerable < RegistryKey > AllSubKeys ( RegistryKey key )
@@ -141,7 +146,7 @@ private static IEnumerable<RegistryKey> AllSubKeys(RegistryKey key)
141
146
142
147
private static bool CanBuildTarget ( string exePath , string target )
143
148
{
144
- if ( ! File . Exists ( exePath ) )
149
+ if ( ! File . Exists ( exePath ) )
145
150
return false ;
146
151
if ( String . Equals ( DefaultTarget , target , StringComparison . OrdinalIgnoreCase ) )
147
152
return true ;
0 commit comments