Skip to content

Commit

Permalink
Merge pull request lucaslorentz#32 from bhugot/patch-1
Browse files Browse the repository at this point in the history
Change GetSourceRelativePath
  • Loading branch information
lucaslorentz authored Feb 26, 2018
2 parents 2f7fbd4 + 990f3ea commit 9f70f74
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/MiniCover/Instrumentation/Instrumenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,15 +333,17 @@ private void InstrumentInstruction(int instructionId, Instruction instruction,

private string GetSourceRelativePath(string path)
{
if (!path.StartsWith(normalizedWorkDir))
return null;

if (!sourceFiles.Contains(path))
return null;

return path.Substring(normalizedWorkDir.Length);
Uri file = new Uri(path);
Uri folder = new Uri(normalizedWorkDir);
string relativePath =
Uri.UnescapeDataString(
folder.MakeRelativeUri(file)
.ToString()
.Replace('/', Path.DirectorySeparatorChar)
);
return relativePath;
}

private string GetPdbFile(string assemblyFile)
{
return Path.ChangeExtension(assemblyFile, "pdb");
Expand Down

0 comments on commit 9f70f74

Please sign in to comment.