mirror of
https://github.com/github/codeql.git
synced 2026-06-21 21:01:13 +02:00
C#: Handle the places where we could risk that Path.Combine would have thrown away the first argument.
This commit is contained in:
@@ -108,7 +108,8 @@ namespace Semmle.Autobuild.Shared
|
||||
}
|
||||
|
||||
var includePath = builder.Actions.PathJoin(include.Value.Split('\\', StringSplitOptions.RemoveEmptyEntries));
|
||||
ret.Add(new Project<TAutobuildOptions>(builder, builder.Actions.PathJoin(DirectoryName, includePath)));
|
||||
var path = Path.IsPathRooted(includePath) ? includePath : builder.Actions.PathJoin(DirectoryName, includePath);
|
||||
ret.Add(new Project<TAutobuildOptions>(builder, path));
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
|
||||
@@ -159,7 +159,11 @@ namespace Semmle.Extraction.CSharp
|
||||
return null;
|
||||
}
|
||||
|
||||
return Path.GetFullPath(Path.Join(projDir?.FullName ?? string.Empty, Path.DirectorySeparatorChar == '/' ? file.Replace("\\", "/") : file));
|
||||
var normalized = Path.DirectorySeparatorChar == '/' ? file.Replace("\\", "/") : file;
|
||||
var path = projDir is not null && !Path.IsPathRooted(normalized)
|
||||
? Path.Join(projDir.FullName, normalized)
|
||||
: normalized;
|
||||
return Path.GetFullPath(path);
|
||||
}
|
||||
|
||||
private readonly string[] references;
|
||||
|
||||
Reference in New Issue
Block a user