Skip to content

Commit

Permalink
return full path if base path is empty
Browse files Browse the repository at this point in the history
Fixes #54
  • Loading branch information
tonerdo committed Apr 28, 2018
1 parent f0ed61d commit b42cca2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/coverlet.core/Reporters/CoberturaReporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public string Report(CoverageResult result)
private string GetBasePath(Modules modules)
{
List<string> sources = new List<string>();
string source = string.Empty;
string path = string.Empty;

foreach (var module in modules)
{
Expand All @@ -141,17 +141,17 @@ private string GetBasePath(Modules modules)

foreach (var segment in segments)
{
var startsWith = sources.All(s => s.StartsWith(source + segment));
var startsWith = sources.All(s => s.StartsWith(path + segment));
if (!startsWith)
break;

source += segment + Path.DirectorySeparatorChar;
path += segment + Path.DirectorySeparatorChar;
}

return source;
return path;
}

private string GetRelativePathFromBase(string source, string path)
=> path.Replace(source, string.Empty);
private string GetRelativePathFromBase(string basePath, string path)
=> basePath == string.Empty ? path : path.Replace(basePath, string.Empty);
}
}

0 comments on commit b42cca2

Please sign in to comment.