BUG: a couple bugs in system informaiton

This commit is contained in:
Ken Martin 2007-03-01 10:53:09 -05:00
parent c931d330c9
commit c733ab2701
1 changed files with 6 additions and 5 deletions

View File

@ -2928,6 +2928,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
} }
// process the arguments // process the arguments
bool writeToStdout = true;
for(unsigned int i=1; i < args.size(); ++i) for(unsigned int i=1; i < args.size(); ++i)
{ {
std::string arg = args[i]; std::string arg = args[i];
@ -2965,10 +2966,11 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
{ {
if (!cmSystemTools::FileIsFullPath(arg.c_str())) if (!cmSystemTools::FileIsFullPath(arg.c_str()))
{ {
resultFile += cwd; resultFile = cwd;
resultFile += "/"; resultFile += "/";
} }
resultFile = arg; resultFile += arg;
writeToStdout = false;
} }
} }
@ -3000,14 +3002,13 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
// now run cmake on the CMakeLists file // now run cmake on the CMakeLists file
cmSystemTools::ChangeDirectory(destPath.c_str()); cmSystemTools::ChangeDirectory(destPath.c_str());
cmake cm;
std::vector<std::string> args2; std::vector<std::string> args2;
args2.push_back(args[0]); args2.push_back(args[0]);
args2.push_back(destPath); args2.push_back(destPath);
std::string resultArg = "-DRESULT_FILE="; std::string resultArg = "-DRESULT_FILE=";
resultArg += resultFile; resultArg += resultFile;
args2.push_back(resultArg); args2.push_back(resultArg);
int res = cm.Run(args2, false); int res = this->Run(args2, false);
if (res != 0) if (res != 0)
{ {
@ -3019,7 +3020,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
cmSystemTools::ChangeDirectory(cwd.c_str()); cmSystemTools::ChangeDirectory(cwd.c_str());
// echo results to stdout if needed // echo results to stdout if needed
if (args.size() == 1) if (writeToStdout)
{ {
FILE* fin = fopen(resultFile.c_str(), "r"); FILE* fin = fopen(resultFile.c_str(), "r");
if(fin) if(fin)