summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Barre <sebastien.barre@kitware.com>2008-03-13 09:28:26 -0400
committerSebastien Barre <sebastien.barre@kitware.com>2008-03-13 09:28:26 -0400
commitcddb1346b7426e4693927b41637f43919f0174f7 (patch)
tree0daca5849794732a99adb13c27dcc3a4b566f9ea
parentb40890c8ca546d206f8445b3f8c1535cf3f450b0 (diff)
downloadcmake-cddb1346b7426e4693927b41637f43919f0174f7.tar.gz
BUG: the directory the FILE DOWNLOAD command is writing to might not exist.
-rw-r--r--Source/cmFileCommand.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 8868812df8..aa9731bb72 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2060,6 +2060,17 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
}
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)
{