mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 10:21:57 -05:00
Fix #14523: suppress downloads if a directory exists
This commit is contained in:
parent
217b5a5c48
commit
5212117924
2 changed files with 17 additions and 1 deletions
|
@ -401,22 +401,28 @@ if (NOT MACOS_BUNDLE OR (MACOS_BUNDLE AND WITH_TESTS))
|
||||||
install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" --build \"${CMAKE_CURRENT_BINARY_DIR}\" --target g2)")
|
install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" --build \"${CMAKE_CURRENT_BINARY_DIR}\" --target g2)")
|
||||||
if (DOWNLOAD_TITLE_SEQUENCES)
|
if (DOWNLOAD_TITLE_SEQUENCES)
|
||||||
# Checks if this version of the title sequences are already installed, updates if necessary
|
# Checks if this version of the title sequences are already installed, updates if necessary
|
||||||
|
# if /data/sequence exists, it will overwrite this anyways (see `install(DIRECTORY "data/" ...)` below)
|
||||||
|
# therefore, the existence of that directory will skip this download
|
||||||
install(CODE "
|
install(CODE "
|
||||||
include(${ROOT_DIR}/cmake/download.cmake)
|
include(${ROOT_DIR}/cmake/download.cmake)
|
||||||
download_openrct2_zip(
|
download_openrct2_zip(
|
||||||
ZIP_VERSION ${TITLE_SEQUENCE_VERSION}
|
ZIP_VERSION ${TITLE_SEQUENCE_VERSION}
|
||||||
DOWNLOAD_DIR \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/sequence/
|
DOWNLOAD_DIR \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/sequence/
|
||||||
|
SKIP_IF_EXISTS ${CMAKE_SOURCE_DIR}/data/sequence/
|
||||||
ZIP_URL ${TITLE_SEQUENCE_URL}
|
ZIP_URL ${TITLE_SEQUENCE_URL}
|
||||||
SHA1 ${TITLE_SEQUENCE_SHA1}
|
SHA1 ${TITLE_SEQUENCE_SHA1}
|
||||||
)")
|
)")
|
||||||
endif ()
|
endif ()
|
||||||
if (DOWNLOAD_OBJECTS)
|
if (DOWNLOAD_OBJECTS)
|
||||||
# Checks if this version of the objects are already installed, updates if necessary
|
# Checks if this version of the objects are already installed, updates if necessary
|
||||||
|
# if /data/object exists, it will overwrite this anyways (see `install(DIRECTORY "data/" ...)` below)
|
||||||
|
# therefore, the existence of that directory will skip this download
|
||||||
install(CODE "
|
install(CODE "
|
||||||
include(${ROOT_DIR}/cmake/download.cmake)
|
include(${ROOT_DIR}/cmake/download.cmake)
|
||||||
download_openrct2_zip(
|
download_openrct2_zip(
|
||||||
ZIP_VERSION ${OBJECTS_VERSION}
|
ZIP_VERSION ${OBJECTS_VERSION}
|
||||||
DOWNLOAD_DIR \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/object/
|
DOWNLOAD_DIR \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/object/
|
||||||
|
SKIP_IF_EXISTS ${CMAKE_SOURCE_DIR}/data/object/
|
||||||
ZIP_URL ${OBJECTS_URL}
|
ZIP_URL ${OBJECTS_URL}
|
||||||
SHA1 ${OBJECTS_SHA1}
|
SHA1 ${OBJECTS_SHA1}
|
||||||
)")
|
)")
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
function(download_openrct2_zip)
|
function(download_openrct2_zip)
|
||||||
set(oneValueArgs ZIP_VERSION DOWNLOAD_DIR ZIP_URL SHA1)
|
set(oneValueArgs ZIP_VERSION DOWNLOAD_DIR ZIP_URL SHA1)
|
||||||
|
set(multiValueArgs SKIP_IF_EXISTS)
|
||||||
cmake_parse_arguments(DOWNLOAD_OPENRCT2 "${options}" "${oneValueArgs}"
|
cmake_parse_arguments(DOWNLOAD_OPENRCT2 "${options}" "${oneValueArgs}"
|
||||||
"${multiValueArgs}" ${ARGN} )
|
"${multiValueArgs}" ${ARGN} )
|
||||||
|
|
||||||
|
@ -15,9 +16,18 @@ function(download_openrct2_zip)
|
||||||
set(DOWNLOAD_ZIP 1)
|
set(DOWNLOAD_ZIP 1)
|
||||||
endif ()
|
endif ()
|
||||||
else ()
|
else ()
|
||||||
set(DOWNLOAD_ZIP 1)
|
set(DOWNLOAD_ZIP 1)
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
foreach(check_exist_dir ${DOWNLOAD_OPENRCT2_SKIP_IF_EXISTS})
|
||||||
|
if (EXISTS ${check_exist_dir})
|
||||||
|
message("${check_exist_dir} exists, skipping download")
|
||||||
|
set(DOWNLOAD_ZIP 0)
|
||||||
|
break()
|
||||||
|
endif ()
|
||||||
|
endforeach(check_exist_dir)
|
||||||
|
|
||||||
if (DOWNLOAD_ZIP)
|
if (DOWNLOAD_ZIP)
|
||||||
message("Downloading ${DOWNLOAD_OPENRCT2_DOWNLOAD_DIR}")
|
message("Downloading ${DOWNLOAD_OPENRCT2_DOWNLOAD_DIR}")
|
||||||
file(DOWNLOAD
|
file(DOWNLOAD
|
||||||
|
|
Loading…
Reference in a new issue