|
|
|
@ -31,14 +31,9 @@ namespace CppSharp.Passes
@@ -31,14 +31,9 @@ namespace CppSharp.Passes
|
|
|
|
|
includeDir = "."; |
|
|
|
|
includeDir = Path.GetFullPath(includeDir); |
|
|
|
|
|
|
|
|
|
Module module = Options.Modules.Find( |
|
|
|
|
m => m.IncludeDirs.Any(i => Path.GetFullPath(i) == includeDir)); |
|
|
|
|
if (module == null) |
|
|
|
|
{ |
|
|
|
|
unit.ExplicitlyIgnore(); |
|
|
|
|
module = Options.Modules[1]; |
|
|
|
|
} |
|
|
|
|
return module; |
|
|
|
|
return Options.Modules.FirstOrDefault( |
|
|
|
|
m => m.IncludeDirs.Any(i => Path.GetFullPath(i) == includeDir)) ?? |
|
|
|
|
Options.Modules[1]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override bool VisitDeclarationContext(DeclarationContext context) |
|
|
|
@ -46,9 +41,10 @@ namespace CppSharp.Passes
@@ -46,9 +41,10 @@ namespace CppSharp.Passes
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private string GetIncludePath(string filePath) |
|
|
|
|
string GetIncludePath(string filePath) |
|
|
|
|
{ |
|
|
|
|
var includePath = filePath; |
|
|
|
|
var shortestIncludePath = filePath; |
|
|
|
|
|
|
|
|
|
for (uint i = 0; i < Context.ParserOptions.IncludeDirsCount; ++i) |
|
|
|
|
{ |
|
|
|
@ -61,15 +57,16 @@ namespace CppSharp.Passes
@@ -61,15 +57,16 @@ namespace CppSharp.Passes
|
|
|
|
|
idx = filePath.IndexOf(path, System.StringComparison.Ordinal); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (idx != -1) |
|
|
|
|
{ |
|
|
|
|
includePath = filePath[path.Length..]; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
if (idx == -1) continue; |
|
|
|
|
|
|
|
|
|
string inc = filePath.Substring(path.Length); |
|
|
|
|
|
|
|
|
|
if (inc.Length < includePath.Length && inc.Length < shortestIncludePath.Length) |
|
|
|
|
shortestIncludePath = inc; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
includePath = Options.IncludePrefix |
|
|
|
|
+ includePath.TrimStart(new char[] { '\\', '/' }); |
|
|
|
|
+ shortestIncludePath.TrimStart(new char[] { '\\', '/' }); |
|
|
|
|
|
|
|
|
|
return includePath.Replace('\\', '/'); |
|
|
|
|
} |
|
|
|
|