Merge pull request #3 from Yoplitein/handle-download-failure

Handle package files that failed to download
This commit is contained in:
Dragos Carp 2014-07-04 16:25:28 +02:00
commit 0de1d54527

View file

@ -50,7 +50,13 @@ include(ExternalProject)
function(DubProject_Add name) function(DubProject_Add name)
if(NOT EXISTS ${DUB_DIRECTORY}/${name}.json) if(NOT EXISTS ${DUB_DIRECTORY}/${name}.json)
file(DOWNLOAD ${DUB_REGISTRY}/${name}.json ${DUB_DIRECTORY}/${name}.json) file(DOWNLOAD ${DUB_REGISTRY}/${name}.json ${DUB_DIRECTORY}/${name}.json STATUS status)
list(GET status 0 statusCode)
if(NOT statusCode EQUAL 0)
file(REMOVE ${DUB_DIRECTORY}/${name}.json)
message(FATAL_ERROR "Failed to download ${DUB_REGISTRY}/${name}.json")
endif(NOT statusCode EQUAL 0)
endif(NOT EXISTS ${DUB_DIRECTORY}/${name}.json) endif(NOT EXISTS ${DUB_DIRECTORY}/${name}.json)
if(${ARGC} GREATER 1) if(${ARGC} GREATER 1)