[cmake-commits] martink committed cmake.cxx 1.269 1.270
cmake-commits at cmake.org
cmake-commits at cmake.org
Mon Oct 16 12:49:28 EDT 2006
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv13474
Modified Files:
cmake.cxx
Log Message:
BUG: partial fix for the progress after install bug
Index: cmake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.cxx,v
retrieving revision 1.269
retrieving revision 1.270
diff -u -d -r1.269 -r1.270
--- cmake.cxx 6 Oct 2006 15:11:59 -0000 1.269
+++ cmake.cxx 16 Oct 2006 16:49:26 -0000 1.270
@@ -996,16 +996,19 @@
std::string dirName = args[2];
dirName += "/Progress";
cmSystemTools::RemoveADirectory(dirName.c_str());
- cmSystemTools::MakeDirectory(dirName.c_str());
- // write the count into the directory
- std::string fName = dirName;
- fName += "/count.txt";
- FILE *progFile = fopen(fName.c_str(),"w");
- if (progFile)
+ int count = atoi(args[3].c_str());
+ if (count)
{
- int count = atoi(args[3].c_str());
- fprintf(progFile,"%i\n",count);
- fclose(progFile);
+ cmSystemTools::MakeDirectory(dirName.c_str());
+ // write the count into the directory
+ std::string fName = dirName;
+ fName += "/count.txt";
+ FILE *progFile = fopen(fName.c_str(),"w");
+ if (progFile)
+ {
+ fprintf(progFile,"%i\n",count);
+ fclose(progFile);
+ }
}
return 0;
}
@@ -1017,6 +1020,21 @@
dirName += "/Progress";
std::string fName;
FILE *progFile;
+
+ // read the count
+ fName = dirName;
+ fName += "/count.txt";
+ progFile = fopen(fName.c_str(),"r");
+ int count = 0;
+ if (!progFile)
+ {
+ return 0;
+ }
+ else
+ {
+ fscanf(progFile,"%i",&count);
+ fclose(progFile);
+ }
unsigned int i;
for (i = 3; i < args.size(); ++i)
{
@@ -1032,20 +1050,10 @@
}
int fileNum = static_cast<int>
(cmsys::Directory::GetNumberOfFilesInDirectory(dirName.c_str()));
- // read the count
- fName = dirName;
- fName += "/count.txt";
- progFile = fopen(fName.c_str(),"r");
- if (progFile)
+ if (count > 0)
{
- int count = 0;
- fscanf(progFile,"%i",&count);
- if (count > 0)
- {
- // print the progress
- fprintf(stdout,"[%3i%%] ",((fileNum-3)*100)/count);
- }
- fclose(progFile);
+ // print the progress
+ fprintf(stdout,"[%3i%%] ",((fileNum-3)*100)/count);
}
return 0;
}
More information about the Cmake-commits
mailing list