Browse Source

Fix TranslationUnit.FileRelativeDirectory to be more robust against null include paths.

pull/1359/head
João Matos 5 years ago committed by João Matos
parent
commit
568b68bb3f
  1. 7
      src/AST/TranslationUnit.cs

7
src/AST/TranslationUnit.cs

@ -62,7 +62,12 @@ namespace CppSharp.AST @@ -62,7 +62,12 @@ namespace CppSharp.AST
{
get
{
if (fileRelativeDirectory != null) return fileRelativeDirectory;
if (fileRelativeDirectory != null)
return fileRelativeDirectory;
if (IncludePath == null)
return string.Empty;
var path = IncludePath.Replace('\\', '/');
var index = path.LastIndexOf('/');
return fileRelativeDirectory = path.Substring(0, index);

Loading…
Cancel
Save