Skip to content

Commit f18022b

Browse files
committed
Fix TU.FileRelativeDirectory to be more robust against some paths.
1 parent 2cfd76b commit f18022b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/AST/TranslationUnit.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ public string FileRelativeDirectory
7171

7272
var path = IncludePath.Replace('\\', '/');
7373
var index = path.LastIndexOf('/');
74+
if (index == -1)
75+
return string.Empty;
76+
7477
return fileRelativeDirectory = path.Substring(0, index);
7578
}
7679
}

0 commit comments

Comments
 (0)