From e5838b892c8f8041868d3ee08110261cde13e098 Mon Sep 17 00:00:00 2001 From: marha Date: Tue, 4 Aug 2009 11:56:03 +0000 Subject: - Made copy command recursive when copying a directory. - When -q is specified output nothing. - Solved problem when mhmake is run from inside Visual Studio (output of cl.exe was send directly to the IDE instead of stdout) - Added strip function - Now use the svn info command to get the revision from the working copy. - Removed VC6 solution file. --- tools/mhmake/src/util.cpp | 82 ++++++++++++----------------------------------- 1 file changed, 20 insertions(+), 62 deletions(-) (limited to 'tools/mhmake/src/util.cpp') diff --git a/tools/mhmake/src/util.cpp b/tools/mhmake/src/util.cpp index 2e0b7dea6..824c94b4d 100644 --- a/tools/mhmake/src/util.cpp +++ b/tools/mhmake/src/util.cpp @@ -255,6 +255,9 @@ refptr LOADEDMAKEFILES::find(const loadedmakefile &ToSearch) LOADEDMAKEFILES g_LoadedMakefiles; +bool OsExeCommand(const string &Command,const string &Params,bool IgnoreError,string *pOutput); +string SearchCommand(const string &Command, const string &Extension=""); + /////////////////////////////////////////////////////////////////////////////// loadedmakefile::loadedmakefile_statics::loadedmakefile_statics() { @@ -266,79 +269,34 @@ loadedmakefile::loadedmakefile_statics::loadedmakefile_statics() m_MhMakeConf=GetFileInfo(pEnv); // Get the revision of the working copy - // We do it the fastest way: this means just parsing the entries file in the .svn directory of the mhmakeconf directory - string EntriesFile=m_MhMakeConf->GetFullFileName()+OSPATHSEPSTR".svn"OSPATHSEPSTR"entries"; - FILE *pFile=fopen(EntriesFile.c_str(),"r"); - if (!pFile) - { - /* Entries file cannot be opened. Maybe it is not an svn working copy, so ignore it */ - #ifdef _DEBUG - if (g_PrintAdditionalInfo) cout<<"Warning: Assuming no subversion working copy: Error opening "<GetFullFileName(),false,&Output); } - #endif - *pEnd='\0'; - m_GlobalCommandLineVars[WC_URL]=pUrl; - } - if (!strncmp(Line," revision=\"",13)) - { - char *pRevision=Line+13; - char *pEnd=strchr(pRevision,'"'); - #ifdef _DEBUG - if (!pEnd) + catch (int) { - cerr<<"Format of entries file in .svn directory must have been changed. Update mhmake!\n"; - exit(1); - } - #endif - *pEnd='\0'; - m_GlobalCommandLineVars[WC_REVISION]=pRevision; - break; - } + Ret=false; } - } - else + + char *pTok=strtok((char*)Output.c_str(),"\n"); // doing this is changing string, so this is very dangerous !!! + while (pTok) { - /* This is the new format */ - fgets(Line,sizeof(Line),pFile); - fgets(Line,sizeof(Line),pFile); - if (fgets(Line,sizeof(Line),pFile)) + if (!strncmp(pTok,"URL: ",5)) { - Line[strlen(Line)-1]=0; - m_GlobalCommandLineVars[WC_REVISION]=Line; + m_GlobalCommandLineVars[WC_URL]=pTok+5+7; } - if (fgets(Line,sizeof(Line),pFile)) + else if (!strncmp(pTok,"Revision: ",10)) { - Line[strlen(Line)-1]=0; - m_GlobalCommandLineVars[WC_URL]=Line+7; - } + m_GlobalCommandLineVars[WC_REVISION]=pTok+10; + break; } + pTok=strtok(NULL,"\n"); } - fclose(pFile); } } -- cgit v1.2.3