Browse Source

Fixed Windows UCRT toolchain code to not combine absolute paths.

Previously the partial UCRT path obtained from `ucrtPaths` would always start with `\`.

Combined with the behavior of Path.Combine(p1,p2) to always return p2 when it is absolute, we'd always end up with an incomplete partial path.
pull/621/head
Joao Matos 10 years ago
parent
commit
e95012441c
  1. 3
      src/Core/Toolchains/MSVCToolchain.cs

3
src/Core/Toolchains/MSVCToolchain.cs

@ -239,8 +239,9 @@ namespace CppSharp
// however, it cannot be used because it needs invoking an external process to run the .bat // however, it cannot be used because it needs invoking an external process to run the .bat
// which is killed prematurely by VS when the pre-build events of wrapper projects are run // which is killed prematurely by VS when the pre-build events of wrapper projects are run
const string ucrtVersionEnvVar = "%UCRTVersion%"; const string ucrtVersionEnvVar = "%UCRTVersion%";
foreach (var path in ucrtPaths.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) foreach (var splitPath in ucrtPaths.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{ {
var path = splitPath.TrimStart('\\');
var index = path.IndexOf(ucrtVersionEnvVar, StringComparison.Ordinal); var index = path.IndexOf(ucrtVersionEnvVar, StringComparison.Ordinal);
if (index >= 0) if (index >= 0)
{ {

Loading…
Cancel
Save