public string ResolvePath(string fileName) {
if (fileName == null) throw new ArgumentNullException("fileName");
// If the argument is the fully qualified path of an existing file,
// then we are done
if (File.Exists(fileName)) {
return fileName;
}
// Maybe the file is in the same folder as the text template that
// called the directive.
string candidate = Path.Combine(Path.GetDirectoryName(TemplateFile), fileName);
if (File.Exists(candidate)) {
return candidate;
}
return fileName;
}