From cddb1346b7426e4693927b41637f43919f0174f7 Mon Sep 17 00:00:00 2001 From: Sebastien Barre Date: Thu, 13 Mar 2008 09:28:26 -0400 Subject: BUG: the directory the FILE DOWNLOAD command is writing to might not exist. --- Source/cmFileCommand.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 8868812..aa9731b 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2060,6 +2060,17 @@ cmFileCommand::HandleDownloadCommand(std::vector } 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) { -- cgit v0.12