Handle package files that failed to download

This commit is contained in:
Steven Dwy 2014-06-09 11:02:49 -07:00
parent f6f31bf6e6
commit 3a62186e55

View file

@ -50,7 +50,13 @@ include(ExternalProject)
function(DubProject_Add name)
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)
if(${ARGC} GREATER 1)