From b16f225e4735243eeceb198dd823199b96f5c92f Mon Sep 17 00:00:00 2001 From: hiker Date: Thu, 21 Apr 2016 22:28:50 +1000 Subject: [PATCH] Fixed path in installer, and support common different names for the build directory (bld, build, cmake_build). --- src/windows_installer/supertuxkart.nsi | 35 +++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/windows_installer/supertuxkart.nsi b/src/windows_installer/supertuxkart.nsi index fa6ea2166..03a7a4382 100755 --- a/src/windows_installer/supertuxkart.nsi +++ b/src/windows_installer/supertuxkart.nsi @@ -112,6 +112,28 @@ FunctionEnd !insertmacro MUI_LANGUAGE "English" + +; --------------------------------------------------------------------------- +; based on http://nsis.sourceforge.net/Check_if_a_file_exists_at_compile_time +; Sets the variable _VAR_NAME to _FILE_NAME if _VAR_NAME is not defined yet +; and _FILE_NAME exists: +!macro !setIfUndefinedAndExists _VAR_NAME _FILE_NAME + !ifndef ${_VAR_NAME} + !tempfile _TEMPFILE + !ifdef NSIS_WIN32_MAKENSIS + ; Windows - cmd.exe + !system 'if exist "${_FILE_NAME}" echo !define ${_VAR_NAME} "${_FILE_NAME}" > "${_TEMPFILE}"' + !else + ; Posix - sh + !system 'if [ -e "${_FILE_NAME}" ]; then echo "!define ${_VAR_NAME} ${_FILE_NAME}" > "${_TEMPFILE}"; fi' + !endif + !include '${_TEMPFILE}' + !delfile '${_TEMPFILE}' + !undef _TEMPFILE + !endif +!macroend +!define !setIfUndefinedAndExists "!insertmacro !setIfUndefinedAndExists" + ;-------------------------------- ;Installer Sections @@ -120,7 +142,18 @@ Section "Main Section" SecMain SetOutPath "$INSTDIR" ; files in root dir - File /r ..\..\..\build\bin\release\*.* + + ; Try to find the binary directory in a list of 'typical' names: + ; The first found directory is used + ${!setIfUndefinedAndExists} EXEC_PATH ..\..\bld\bin\RelWithDebInfo\*.* + ${!setIfUndefinedAndExists} EXEC_PATH ..\..\bld\bin\Release\*.* + ${!setIfUndefinedAndExists} EXEC_PATH ..\..\build\bin\RelWithDebInfo\*.* + ${!setIfUndefinedAndExists} EXEC_PATH ..\..\build\bin\Release\*.* + ${!setIfUndefinedAndExists} EXEC_PATH ..\..\cmake_build\bin\RelWithDebInfo\*.* + ${!setIfUndefinedAndExists} EXEC_PATH ..\..\cmake_build\bin\Release\*.* + + + File ${EXEC_PATH} File *.ico ; prereqs SetOutPath "$INSTDIR\prerequisities"