- Add defaultPath global var and use it instead of creating Path objects all the time a filename is queried and/or xml file is read.

svn path=/trunk/; revision=38352
This commit is contained in:
Aleksey Bragin 2008-12-26 11:03:16 +00:00
parent c5c0af3081
commit 03a011db89
3 changed files with 6 additions and 5 deletions

View file

@ -161,9 +161,8 @@ NormalizeFilename ( const string& filename )
{
if ( filename == "" )
return "";
Path path;
string normalizedPath = path.Fixup ( filename, true );
string relativeNormalizedPath = path.RelativeFromWorkingDirectory ( normalizedPath );
string normalizedPath = defaultPath.Fixup ( filename, true );
string relativeNormalizedPath = defaultPath.RelativeFromWorkingDirectory ( normalizedPath );
return FixSeparator ( relativeNormalizedPath );
}

View file

@ -25,6 +25,8 @@
using std::string;
using std::vector;
const Path defaultPath;
/* static */ string
Environment::GetVariable ( const string& name )
{
@ -259,8 +261,7 @@ Project::ExecuteInvocations ()
void
Project::ReadXml ()
{
Path path;
head = XMLLoadFile ( xmlfile, path, xmlbuildfiles );
head = XMLLoadFile ( xmlfile, defaultPath, xmlbuildfiles );
node = NULL;
for ( size_t i = 0; i < head->subElements.size (); i++ )
{

View file

@ -51,6 +51,7 @@ extern std::string sSep;
extern std::string sBadSep;
extern char cSep;
extern char cBadSep;
extern const Path defaultPath;
#ifdef WIN32
#define DEF_EXEPREFIX ""