Skip to content

Commit

Permalink
Return dotnet.exe location from registry before programfiles location
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfsck committed Feb 12, 2019
1 parent 848b4f6 commit 200c253
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,6 @@ static IEnumerable<string> GetDotNetCoreBaseDirCandidates() {
yield return path;
}

// Check default locations
var progDirX86 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
var progDir = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
if (StringComparer.OrdinalIgnoreCase.Equals(progDirX86, progDir))
progDir = Path.Combine(Path.GetDirectoryName(progDir), "Program Files");
const string dotnetDirName = "dotnet";
if (!string.IsNullOrEmpty(progDir))
yield return Path.Combine(progDir, dotnetDirName);
if (!string.IsNullOrEmpty(progDirX86))
yield return Path.Combine(progDirX86, dotnetDirName);

var regPathFormat = IntPtr.Size == 4 ?
@"SOFTWARE\dotnet\Setup\InstalledVersions\{0}\sdk" :
@"SOFTWARE\WOW6432Node\dotnet\Setup\InstalledVersions\{0}\sdk";
Expand All @@ -103,6 +92,17 @@ bool TryGetInstallLocationFromRegistry(string regPath, out string installLocatio
return installLocation != null;
}
}

// Check default locations
var progDirX86 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
var progDir = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
if (StringComparer.OrdinalIgnoreCase.Equals(progDirX86, progDir))
progDir = Path.Combine(Path.GetDirectoryName(progDir), "Program Files");
const string dotnetDirName = "dotnet";
if (!string.IsNullOrEmpty(progDir))
yield return Path.Combine(progDir, dotnetDirName);
if (!string.IsNullOrEmpty(progDirX86))
yield return Path.Combine(progDirX86, dotnetDirName);
}

public static string GetDebugShimFilename(int bitness) {
Expand Down
22 changes: 11 additions & 11 deletions dnSpy/dnSpy/Documents/DotNetCorePathProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,6 @@ static IEnumerable<string> GetDotNetCoreBaseDirCandidates() {
yield return path;
}

// Check default locations
var progDirX86 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
var progDir = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
if (StringComparer.OrdinalIgnoreCase.Equals(progDirX86, progDir))
progDir = Path.Combine(Path.GetDirectoryName(progDir), "Program Files");
const string dotnetDirName = "dotnet";
if (!string.IsNullOrEmpty(progDir))
yield return Path.Combine(progDir, dotnetDirName);
if (!string.IsNullOrEmpty(progDirX86))
yield return Path.Combine(progDirX86, dotnetDirName);

var regPathFormat = IntPtr.Size == 4 ?
@"SOFTWARE\dotnet\Setup\InstalledVersions\{0}\sdk" :
@"SOFTWARE\WOW6432Node\dotnet\Setup\InstalledVersions\{0}\sdk";
Expand All @@ -247,6 +236,17 @@ bool TryGetInstallLocationFromRegistry(string regPath, out string installLocatio
return installLocation != null;
}
}

// Check default locations
var progDirX86 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
var progDir = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
if (StringComparer.OrdinalIgnoreCase.Equals(progDirX86, progDir))
progDir = Path.Combine(Path.GetDirectoryName(progDir), "Program Files");
const string dotnetDirName = "dotnet";
if (!string.IsNullOrEmpty(progDir))
yield return Path.Combine(progDir, dotnetDirName);
if (!string.IsNullOrEmpty(progDirX86))
yield return Path.Combine(progDirX86, dotnetDirName);
}

static IEnumerable<FrameworkPath> GetDotNetCorePaths(string basePath, int bitness) {
Expand Down

0 comments on commit 200c253

Please sign in to comment.