Skip to content

Commit 5b04a56

Browse files
committed
#773: Improved handling of file paths on Unix systems
1 parent 1af4ede commit 5b04a56

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/Readme.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ For further details take a look at LICENSE.txt.
6969

7070
CHANGELOG
7171

72+
5.5.2.0
73+
74+
* Fix: #773: Improved handling of file paths on Unix systems
75+
7276
5.5.1.0
7377

7478
* New: #766: Added new setting "preserveTrailingEmptyLine".

src/ReportGenerator.Core/Parser/Analysis/CodeFile.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,22 @@ public override bool Equals(object obj)
324324
else
325325
{
326326
var codeFile = (CodeFile)obj;
327+
327328
string fileNameToCompare = codeFile.Path.Substring(codeFile.Path.LastIndexOf('\\') + 1);
329+
int indexOfSlash = codeFile.Path.LastIndexOf('/');
330+
331+
if (indexOfSlash != -1)
332+
{
333+
fileNameToCompare = codeFile.Path.Substring(indexOfSlash + 1);
334+
}
328335

329336
string fileName = this.Path.Substring(this.Path.LastIndexOf('\\') + 1);
337+
indexOfSlash = this.Path.LastIndexOf('/');
338+
if (indexOfSlash != -1)
339+
{
340+
fileName = this.Path.Substring(this.Path.LastIndexOf('/') + 1);
341+
}
342+
330343
return fileName.Equals(fileNameToCompare, StringComparison.OrdinalIgnoreCase);
331344
}
332345
}

0 commit comments

Comments
 (0)