I'm quite new to both C# and XNA so sorry if this is an obvious question. I'm trying to load XML files that contain filenames of textures, so I'm using the XML importer to parse the data into one of my data structures and then use a custom ContentProcessor I've written to convert the each of the texture filenames into references to the actual Texture2D object. So far, I've got this:
[ContentProcessor]
class XImageGridProcessor : ContentProcessor<XImageGridXml, XImageGridData> {
public override XImageGridData Process(
XImageGridXml input, ContentProcessorContext context) {
XImageGridData grid = new XImageGridData();
grid.Texture = new ExternalReference<Texture2DContent>(input.Texture);
... process the rest of the input structure ...
}
}
The problem is that the filenames in the XML file are relative to where the XML file is on disk, so I keep getting an exception complaining that my ExternalReference does not contain an absolute path. Is there an easy way for me to get the path to my XML file in the ContentProcessor so that I can convert these relative paths to absolute ones?