summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorJohnny Jazeix <jazeix@gmail.com>2019-12-23 09:35:41 (GMT)
committerBrad King <brad.king@kitware.com>2020-01-15 15:03:35 (GMT)
commitc0da651c09e11f9868529b7f8c4dc8f97c4546c8 (patch)
tree2c83d48dba0e6bdde0b710b5f89dca4199c4eb7b /Source
parentb56d429324330a9eb8d3c1860333969140851dd7 (diff)
downloadCMake-c0da651c09e11f9868529b7f8c4dc8f97c4546c8.zip
CMake-c0da651c09e11f9868529b7f8c4dc8f97c4546c8.tar.gz
CMake-c0da651c09e11f9868529b7f8c4dc8f97c4546c8.tar.bz2
file(DOWNLOAD): Don't fail if given just a filename to write to
Fixes: #17969
Diffstat (limited to 'Source')
-rw-r--r--Source/cmFileCommand.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 1fdfa87..d1775a7 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -1707,7 +1707,8 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
// as we receive downloaded bits from curl...
//
std::string dir = cmSystemTools::GetFilenamePath(file);
- if (!cmSystemTools::FileExists(dir) && !cmSystemTools::MakeDirectory(dir)) {
+ if (!dir.empty() && !cmSystemTools::FileExists(dir) &&
+ !cmSystemTools::MakeDirectory(dir)) {
std::string errstring = "DOWNLOAD error: cannot create directory '" + dir +
"' - Specify file by full path name and verify that you "
"have directory creation and file write privileges.";