parse, but ignore, <? ?> tags - eliminated duplicate code ala FixSeparator() - fix path separator issues

svn path=/branches/xmlbuildsystem/; revision=12868
This commit is contained in:
Royce Mitchell III
2005-01-07 13:48:53 +00:00
parent f7257ee1be
commit 4e235dbcc9
8 changed files with 53 additions and 45 deletions

View File

@@ -8,37 +8,18 @@
using std::string;
using std::vector;
#ifdef WIN32
#define EXEPOSTFIX ".exe"
#define SEP "\\"
string
FixSeparator ( const string& s )
{
string s2(s);
char* p = strchr ( &s2[0], '/' );
char* p = strchr ( &s2[0], CBAD_SEP );
while ( p )
{
*p++ = '\\';
p = strchr ( p, '/' );
*p++ = CSEP;
p = strchr ( p, CBAD_SEP );
}
return s2;
}
#else
#define EXEPOSTFIX
#define SEP "/"
string
FixSeparator ( const string& s )
{
string s2(s);
char* p = strchr ( &s2[0], '\\' );
while ( p )
{
*p++ = '/';
p = strchr ( p, '\\' );
}
return s2;
}
#endif
Module::Module ( Project* project,
const XMLElement& moduleNode,
@@ -68,7 +49,7 @@ Module::ProcessXML ( const XMLElement& e,
string subpath ( path );
if ( e.name == "file" && e.value.size () )
{
files.push_back ( new File ( path + "/" + e.value ) );
files.push_back ( new File ( path + CSEP + e.value ) );
}
else if ( e.name == "library" && e.value.size () )
{
@@ -78,7 +59,7 @@ Module::ProcessXML ( const XMLElement& e,
{
const XMLAttribute* att = e.GetAttribute ( "name", true );
assert(att);
subpath = path + "/" + att->value;
subpath = path + CSEP + att->value;
}
for ( size_t i = 0; i < e.subElements.size (); i++ )
ProcessXML ( *e.subElements[i], subpath );
@@ -100,7 +81,7 @@ Module::GetModuleType ( const XMLAttribute& attribute )
string
Module::GetPath ()
{
return FixSeparator (path) + SEP + name + EXEPOSTFIX;
return FixSeparator (path) + CSEP + name + EXEPOSTFIX;
}