- 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 == "" ) if ( filename == "" )
return ""; return "";
Path path; string normalizedPath = defaultPath.Fixup ( filename, true );
string normalizedPath = path.Fixup ( filename, true ); string relativeNormalizedPath = defaultPath.RelativeFromWorkingDirectory ( normalizedPath );
string relativeNormalizedPath = path.RelativeFromWorkingDirectory ( normalizedPath );
return FixSeparator ( relativeNormalizedPath ); return FixSeparator ( relativeNormalizedPath );
} }

View file

@ -25,6 +25,8 @@
using std::string; using std::string;
using std::vector; using std::vector;
const Path defaultPath;
/* static */ string /* static */ string
Environment::GetVariable ( const string& name ) Environment::GetVariable ( const string& name )
{ {
@ -259,8 +261,7 @@ Project::ExecuteInvocations ()
void void
Project::ReadXml () Project::ReadXml ()
{ {
Path path; head = XMLLoadFile ( xmlfile, defaultPath, xmlbuildfiles );
head = XMLLoadFile ( xmlfile, path, xmlbuildfiles );
node = NULL; node = NULL;
for ( size_t i = 0; i < head->subElements.size (); i++ ) 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 std::string sBadSep;
extern char cSep; extern char cSep;
extern char cBadSep; extern char cBadSep;
extern const Path defaultPath;
#ifdef WIN32 #ifdef WIN32
#define DEF_EXEPREFIX "" #define DEF_EXEPREFIX ""