Browse Source

Normalize file paths when searching or creating translation units.

pull/1/head
triton 12 years ago
parent
commit
44949b99e3
  1. 11
      src/Bridge/Library.cs

11
src/Bridge/Library.cs

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
namespace CppSharp namespace CppSharp
{ {
@ -106,6 +107,16 @@ namespace CppSharp
/// Finds an existing module or creates a new one given a file path. /// Finds an existing module or creates a new one given a file path.
public TranslationUnit FindOrCreateModule(string file) public TranslationUnit FindOrCreateModule(string file)
{ {
try
{
file = Path.GetFullPath(file);
}
catch (ArgumentException)
{
// Normalization errors are expected when dealing with virtual
// compiler files like <built-in>.
}
var module = TranslationUnits.Find(m => m.FilePath.Equals(file)); var module = TranslationUnits.Find(m => m.FilePath.Equals(file));
if (module == null) if (module == null)

Loading…
Cancel
Save