public virtual string GetImportedVocabFile( string vocabName )
{
// first look at files we're generating
string path = (from file in GeneratedFiles
where Path.GetFileName(file).Equals(vocabName + CodeGenerator.VocabFileExtension)
&& File.Exists(file)
select file)
.FirstOrDefault();
if (path != null)
return path;
path = Path.Combine( LibraryDirectory, vocabName + CodeGenerator.VocabFileExtension );
if ( File.Exists( path ) )
return path;
// We did not find the vocab file in the lib directory, so we need
// to look for it in the output directory which is where .tokens
// files are generated (in the base, not relative to the input
// location.)
//
if ( haveOutputDir )
{
path = Path.Combine( OutputDirectory, vocabName + CodeGenerator.VocabFileExtension );
}
else
{
path = vocabName + CodeGenerator.VocabFileExtension;
}
return path;
}