Fix some corner cases when processing <include> elements in .rbuild files

svn path=/trunk/; revision=29274
This commit is contained in:
Hervé Poussineau 2007-09-28 10:46:10 +00:00
parent 3879561ab6
commit d4ddde1905

View file

@ -59,6 +59,7 @@ void
Include::ProcessXML () Include::ProcessXML ()
{ {
DirectoryLocation root = SourceDirectory; DirectoryLocation root = SourceDirectory;
const Module *base = module;
string relative_path; string relative_path;
const XMLAttribute* att = node->GetAttribute ( "base", false ); const XMLAttribute* att = node->GetAttribute ( "base", false );
@ -70,24 +71,25 @@ Include::ProcessXML ()
"'base' attribute illegal from global <include>" ); "'base' attribute illegal from global <include>" );
if ( att->value == project.name ) if ( att->value == project.name )
{ base = NULL;
relative_path = node->value;
}
else else
{ {
const Module* base = project.LocateModule ( att->value ); base = project.LocateModule ( att->value );
if ( !base ) if ( !base )
throw XMLInvalidBuildFileException ( throw XMLInvalidBuildFileException (
node->location, node->location,
"<include> attribute 'base' references non-existant project or module '%s'", "<include> attribute 'base' references non-existant project or module '%s'",
att->value.c_str() ); att->value.c_str() );
root = GetDefaultDirectoryTree ( base ); root = GetDefaultDirectoryTree ( base );
relative_path = base->output->relative_path;
if ( node->value.length () > 0 && node->value != "." )
relative_path += sSep + node->value;
} }
} }
if ( base )
{
relative_path = base->output->relative_path;
if ( node->value.length () > 0 && node->value != "." )
relative_path += sSep + node->value;
}
else else
relative_path = node->value; relative_path = node->value;