[Cmake-commits] [cmake-commits] barre committed cmFileCommand.cxx 1.102 1.103

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Mar 13 09:28:28 EDT 2008


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv7901/Source

Modified Files:
	cmFileCommand.cxx 
Log Message:
BUG: the directory the FILE DOWNLOAD command is writing to might not exist.


Index: cmFileCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.cxx,v
retrieving revision 1.102
retrieving revision 1.103
diff -C 2 -d -r1.102 -r1.103
*** cmFileCommand.cxx	2 Mar 2008 19:35:23 -0000	1.102
--- cmFileCommand.cxx	13 Mar 2008 13:28:26 -0000	1.103
***************
*** 2061,2064 ****
--- 2061,2075 ----
      i++;
      }
+ 
+   std::string dir = cmSystemTools::GetFilenamePath(file.c_str());
+   if(!cmSystemTools::FileExists(dir.c_str()) &&
+      !cmSystemTools::MakeDirectory(dir.c_str()))
+     {
+     std::string errstring = "FILE(DOWNLOAD ) error; cannot create directory: "
+       + dir + ". Maybe need administrative privileges.";
+     this->SetError(errstring.c_str());
+     return false;
+     }
+ 
    std::ofstream fout(file.c_str(), std::ios::binary);
    if(!fout)



More information about the Cmake-commits mailing list