From 58b69e7eb9be29c60e45d46a880b391e3809e76f Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 18 Sep 2009 14:46:17 +0000 Subject: Changes for making it possible to have spaces in the MHMAKECONF environment variable. --- tools/mhmake/src/functions.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'tools/mhmake/src/functions.cpp') diff --git a/tools/mhmake/src/functions.cpp b/tools/mhmake/src/functions.cpp index 9564610f8..2d93f59cd 100644 --- a/tools/mhmake/src/functions.cpp +++ b/tools/mhmake/src/functions.cpp @@ -449,7 +449,7 @@ string mhmakefileparser::f_filesindirs(const string & Arg) const { first=false; } - Ret+=pFile->GetFullFileName(); + Ret+=pFile->GetQuotedFullFileName(); } return Ret; @@ -460,7 +460,7 @@ string mhmakefileparser::f_fullname(const string & Arg) const { string File=TrimString(Arg); refptr pFile=GetFileInfo(File); - return pFile->GetFullFileName(); + return pFile->GetQuotedFullFileName(); } /////////////////////////////////////////////////////////////////////////////// @@ -491,7 +491,7 @@ static string IterList(const string &List,string (*iterFunc)(const string &FileN static string basename(const string &FileName,const string &) { string Ret=FileName.substr(0,FileName.find_last_of('.')); - if (FileName[0]=='"') + if (FileName[0]=='"' && FileName.end()[-1]=='"') Ret+=s_QuoteString; return Ret; } @@ -513,7 +513,7 @@ static string notdir(const string &FileName,const string &) else { string Ret=g_EmptyString; - if (FileName[0]=='"') + if (FileName[0]=='"' && FileName.end()[-1]=='"') Ret+=s_QuoteString; Ret+=FileName.substr(Pos+1); return Ret; @@ -651,7 +651,7 @@ static string dir(const string &FileName,const string &) { string Ret=g_EmptyString; Ret+=FileName.substr(0,Pos+1); - if (FileName[0]=='"') + if (FileName[0]=='"' && FileName.end()[-1]=='"') Ret+=s_QuoteString; return Ret; } @@ -715,10 +715,8 @@ static string relpath(const string &FileName,const string &) retPath+=OSPATHSEPSTR".."; pCur++; } - if (!pPath) - return retPath; - else - return retPath+OSPATHSEPSTR+pLast; + if (pPath) + retPath=retPath+OSPATHSEPSTR+pLast; } else { @@ -731,12 +729,12 @@ static string relpath(const string &FileName,const string &) pCur++; } retPath+=pLast; - return retPath; } + return QuoteFileName(retPath); } /////////////////////////////////////////////////////////////////////////////// -// Make a path name relative to the curren directory +// Make a path name relative to the current directory string mhmakefileparser::f_relpath(const string & FileNames) const { return IterList(FileNames,relpath); -- cgit v1.2.3