From 3a62186e55e18506bef689cc6e65d4ae75a4dd33 Mon Sep 17 00:00:00 2001 From: Steven Dwy Date: Mon, 9 Jun 2014 11:02:49 -0700 Subject: [PATCH] Handle package files that failed to download --- cmake-d/UseDub.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake-d/UseDub.cmake b/cmake-d/UseDub.cmake index 2cd3267..8a6fca0 100644 --- a/cmake-d/UseDub.cmake +++ b/cmake-d/UseDub.cmake @@ -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)