| 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|---|
| 2 | ;;
|
|---|
| 3 | ;; Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ;; Contact: Qt Software Information (qt-info@nokia.com)
|
|---|
| 5 | ;;
|
|---|
| 6 | ;; This file is part of the tools applications of the Qt Toolkit.
|
|---|
| 7 | ;;
|
|---|
| 8 | ;; $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 9 | ;; Commercial Usage
|
|---|
| 10 | ;; Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 11 | ;; accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 12 | ;; Software or, alternatively, in accordance with the terms contained in
|
|---|
| 13 | ;; a written agreement between you and Nokia.
|
|---|
| 14 | ;;
|
|---|
| 15 | ;; GNU Lesser General Public License Usage
|
|---|
| 16 | ;; Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 17 | ;; General Public License version 2.1 as published by the Free Software
|
|---|
| 18 | ;; Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 19 | ;; packaging of this file. Please review the following information to
|
|---|
| 20 | ;; ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 21 | ;; will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 22 | ;;
|
|---|
| 23 | ;; In addition, as a special exception, Nokia gives you certain
|
|---|
| 24 | ;; additional rights. These rights are described in the Nokia Qt LGPL
|
|---|
| 25 | ;; Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
|---|
| 26 | ;; package.
|
|---|
| 27 | ;;
|
|---|
| 28 | ;; GNU General Public License Usage
|
|---|
| 29 | ;; Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ;; General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ;; Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ;; packaging of this file. Please review the following information to
|
|---|
| 33 | ;; ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ;; met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | ;;
|
|---|
| 36 | ;; If you are unsure which license is appropriate for your use, please
|
|---|
| 37 | ;; contact the sales department at qt-sales@nokia.com.
|
|---|
| 38 | ;; $QT_END_LICENSE$
|
|---|
| 39 | ;;
|
|---|
| 40 | ;; This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
|---|
| 41 | ;; WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|---|
| 42 | ;;
|
|---|
| 43 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|---|
| 44 | !ifndef QTCOMMON_INCLUDE
|
|---|
| 45 | !define QTCOMMON_INCLUDE
|
|---|
| 46 |
|
|---|
| 47 | !macro MakeQtDirectory UN
|
|---|
| 48 | Function ${UN}MakeQtDirectory
|
|---|
| 49 | exch $0
|
|---|
| 50 |
|
|---|
| 51 | push $0
|
|---|
| 52 | push " " #replace
|
|---|
| 53 | push "-" #with
|
|---|
| 54 | call ${UN}ReplaceString
|
|---|
| 55 | pop $0
|
|---|
| 56 |
|
|---|
| 57 | push $0
|
|---|
| 58 | push "(" #replace
|
|---|
| 59 | push "" #with
|
|---|
| 60 | call ${UN}ReplaceString
|
|---|
| 61 | pop $0
|
|---|
| 62 |
|
|---|
| 63 | push $0
|
|---|
| 64 | push ")" #replace
|
|---|
| 65 | push "" #with
|
|---|
| 66 | call ${UN}ReplaceString
|
|---|
| 67 | pop $0
|
|---|
| 68 |
|
|---|
| 69 | exch $0
|
|---|
| 70 | FunctionEnd
|
|---|
| 71 | !macroend
|
|---|
| 72 | !insertmacro MakeQtDirectory ""
|
|---|
| 73 | !insertmacro MakeQtDirectory "un."
|
|---|
| 74 |
|
|---|
| 75 | Function DeleteFloatingLicenseProgram
|
|---|
| 76 | exch $1
|
|---|
| 77 | push $0
|
|---|
| 78 |
|
|---|
| 79 | StrCmp $LICENSE_KEY "" end
|
|---|
| 80 |
|
|---|
| 81 | ClearErrors
|
|---|
| 82 | !ifndef OPENSOURCE_BUILD
|
|---|
| 83 | qtnsisext::IsFloatingLicense $LICENSE_KEY
|
|---|
| 84 | !endif
|
|---|
| 85 | IfErrors end
|
|---|
| 86 | pop $0
|
|---|
| 87 |
|
|---|
| 88 | StrCmp $0 "1" end
|
|---|
| 89 | IfFileExists "$1\bin\qtusagereporter.exe" 0 end
|
|---|
| 90 | Delete "$1\bin\qtusagereporter.exe"
|
|---|
| 91 |
|
|---|
| 92 | end:
|
|---|
| 93 | pop $0
|
|---|
| 94 | pop $1
|
|---|
| 95 | FunctionEnd
|
|---|
| 96 |
|
|---|
| 97 | Function AddStartmenuApplication
|
|---|
| 98 | exch $0
|
|---|
| 99 | IfFileExists "$0\assistant.exe" 0 +2
|
|---|
| 100 | CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Assistant.lnk" "$0\assistant.exe"
|
|---|
| 101 | IfFileExists "$0\designer.exe" 0 +2
|
|---|
| 102 | CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Designer.lnk" "$0\designer.exe"
|
|---|
| 103 | IfFileExists "$0\linguist.exe" 0 +2
|
|---|
| 104 | CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Linguist.lnk" "$0\linguist.exe"
|
|---|
| 105 | IfFileExists "$0\qtdemo.exe" 0 +2
|
|---|
| 106 | CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Examples and Demos.lnk" "$0\qtdemo.exe"
|
|---|
| 107 | IfFileExists "$0\..\README" 0 ReadMeShortCutFinished
|
|---|
| 108 | IfFileExists "$WINDIR\notepad.exe" +3
|
|---|
| 109 | CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Qt Readme.lnk" "$SYSDIR\notepad.exe" "$0\..\README"
|
|---|
| 110 | goto ReadMeShortCutFinished
|
|---|
| 111 | CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Qt Readme.lnk" "$WINDIR\notepad.exe" "$0\..\README"
|
|---|
| 112 | ReadMeShortCutFinished:
|
|---|
| 113 | pop $0
|
|---|
| 114 | FunctionEnd
|
|---|
| 115 |
|
|---|
| 116 | Function un.RemoveStartmenuApplication
|
|---|
| 117 | Delete "$SMPROGRAMS\$STARTMENU_STRING\Assistant.lnk"
|
|---|
| 118 | Delete "$SMPROGRAMS\$STARTMENU_STRING\Designer.lnk"
|
|---|
| 119 | Delete "$SMPROGRAMS\$STARTMENU_STRING\Linguist.lnk"
|
|---|
| 120 | Delete "$SMPROGRAMS\$STARTMENU_STRING\Examples and Demos.lnk"
|
|---|
| 121 | Delete "$SMPROGRAMS\$STARTMENU_STRING\Qt Readme.lnk"
|
|---|
| 122 | FunctionEnd
|
|---|
| 123 |
|
|---|
| 124 | #patch the licence information
|
|---|
| 125 | Function PatchLicenseInformation
|
|---|
| 126 | exch $0
|
|---|
| 127 | push $1
|
|---|
| 128 | push $2
|
|---|
| 129 |
|
|---|
| 130 | DetailPrint "Patching license information..."
|
|---|
| 131 |
|
|---|
| 132 | IfFileExists "$0\src\corelib\global\qconfig.h" 0 +3
|
|---|
| 133 | strcpy $2 "$0\src\corelib\global\qconfig.h"
|
|---|
| 134 | goto PatchLicensee
|
|---|
| 135 |
|
|---|
| 136 | IfFileExists "$0\include\Qt\qconfig.h" 0 PatchConfigPriFile
|
|---|
| 137 | strcpy $2 "$0\include\Qt\qconfig.h"
|
|---|
| 138 |
|
|---|
| 139 | PatchLicensee:
|
|---|
| 140 | push $2
|
|---|
| 141 | push '#define QT_PRODUCT_LICENSEE "'
|
|---|
| 142 | push '#define QT_PRODUCT_LICENSEE "$LICENSEE"$\r$\n'
|
|---|
| 143 | call PatchLine
|
|---|
| 144 |
|
|---|
| 145 | push $2
|
|---|
| 146 | push '#define QT_PRODUCT_LICENSE "'
|
|---|
| 147 | push '#define QT_PRODUCT_LICENSE "$LICENSE_PRODUCT"$\r$\n'
|
|---|
| 148 | call PatchLine
|
|---|
| 149 |
|
|---|
| 150 | push $2
|
|---|
| 151 | ${StrCase} $1 "$LICENSE_PRODUCT" "U"
|
|---|
| 152 | push '# define QT_EDITION QT_EDITION_'
|
|---|
| 153 | push '# define QT_EDITION QT_EDITION_$1$\r$\n'
|
|---|
| 154 | call PatchLine
|
|---|
| 155 |
|
|---|
| 156 | PatchConfigPriFile:
|
|---|
| 157 | IfFileExists "$0\mkspecs\qconfig.pri" 0 PatchLicenseProductDone
|
|---|
| 158 | push "$0\mkspecs\qconfig.pri"
|
|---|
| 159 | push "QT_EDITION = "
|
|---|
| 160 | push "QT_EDITION = $LICENSE_PRODUCT$\r$\n"
|
|---|
| 161 | call PatchLine
|
|---|
| 162 |
|
|---|
| 163 | PatchLicenseProductDone:
|
|---|
| 164 | pop $2
|
|---|
| 165 | pop $1
|
|---|
| 166 | pop $0
|
|---|
| 167 | FunctionEnd
|
|---|
| 168 |
|
|---|
| 169 | Function PatchCommonBinaryFiles
|
|---|
| 170 | exch $2
|
|---|
| 171 | push $0
|
|---|
| 172 | push $1
|
|---|
| 173 |
|
|---|
| 174 | IfFileExists "$2\bin\qmake.exe" 0 +5
|
|---|
| 175 | DetailPrint "Patching paths in qmake..."
|
|---|
| 176 | push $2
|
|---|
| 177 | push "$2\bin\qmake.exe"
|
|---|
| 178 | call PatchBinaryPaths
|
|---|
| 179 |
|
|---|
| 180 | DetailPrint "Patching paths in core..."
|
|---|
| 181 | FindFirst $0 $1 "$2\bin\QtCore*.dll"
|
|---|
| 182 | StrCmp $1 "" ErrorPatching
|
|---|
| 183 | push $2
|
|---|
| 184 | push "$2\bin\$1"
|
|---|
| 185 | call PatchBinaryPaths
|
|---|
| 186 |
|
|---|
| 187 | FindNext $0 $1
|
|---|
| 188 | StrCmp $1 "" ErrorPatching
|
|---|
| 189 | push $2
|
|---|
| 190 | push "$2\bin\$1"
|
|---|
| 191 | call PatchBinaryPaths
|
|---|
| 192 |
|
|---|
| 193 | ErrorPatching:
|
|---|
| 194 |
|
|---|
| 195 | pop $1
|
|---|
| 196 | pop $0
|
|---|
| 197 | pop $2
|
|---|
| 198 | FunctionEnd
|
|---|
| 199 |
|
|---|
| 200 | Function PatchBinaryPaths
|
|---|
| 201 | exch $0
|
|---|
| 202 | exch
|
|---|
| 203 | exch $2
|
|---|
| 204 | push $1
|
|---|
| 205 |
|
|---|
| 206 | !ifndef OPENSOURCE_BUILD
|
|---|
| 207 | qtnsisext::PatchBinary /NOUNLOAD $0 "qt_prfxpath=" "qt_prfxpath=$2"
|
|---|
| 208 | qtnsisext::PatchBinary /NOUNLOAD $0 "qt_docspath=" "qt_docspath=$2\doc"
|
|---|
| 209 | qtnsisext::PatchBinary /NOUNLOAD $0 "qt_hdrspath=" "qt_hdrspath=$2\include"
|
|---|
| 210 | qtnsisext::PatchBinary /NOUNLOAD $0 "qt_libspath=" "qt_libspath=$2\lib"
|
|---|
| 211 | qtnsisext::PatchBinary /NOUNLOAD $0 "qt_binspath=" "qt_binspath=$2\bin"
|
|---|
| 212 | qtnsisext::PatchBinary /NOUNLOAD $0 "qt_plugpath=" "qt_plugpath=$2\plugins"
|
|---|
| 213 | qtnsisext::PatchBinary /NOUNLOAD $0 "qt_datapath=" "qt_datapath=$2"
|
|---|
| 214 | qtnsisext::PatchBinary /NOUNLOAD $0 "qt_trnspath=" "qt_trnspath=$2\translations"
|
|---|
| 215 | qtnsisext::PatchBinary /NOUNLOAD $0 "qt_xmplpath=" "qt_xmplpath=$2\examples"
|
|---|
| 216 | !ifdef MODULE_LICENSECHECK
|
|---|
| 217 | qtnsisext::PatchBinary /NOUNLOAD $0 "qt_lcnsuser=" "qt_lcnsuser=$LICENSEE"
|
|---|
| 218 | qtnsisext::PatchBinary /NOUNLOAD $0 "qt_lcnsprod=" "qt_lcnsprod=$LICENSE_PRODUCT"
|
|---|
| 219 | !endif
|
|---|
| 220 | qtnsisext::PatchBinary $0 "qt_demopath=" "qt_demopath=$2\demos"
|
|---|
| 221 | !endif
|
|---|
| 222 |
|
|---|
| 223 | pop $1
|
|---|
| 224 | pop $2
|
|---|
| 225 | pop $0
|
|---|
| 226 | FunctionEnd
|
|---|
| 227 |
|
|---|
| 228 | #patching the prl files
|
|---|
| 229 | Function PatchPrlFiles
|
|---|
| 230 | exch $2
|
|---|
| 231 | exch
|
|---|
| 232 | exch $3 ;buildDir
|
|---|
| 233 | push $0
|
|---|
| 234 | push $1
|
|---|
| 235 |
|
|---|
| 236 | FindFirst $0 $1 "$2\lib\*.prl"
|
|---|
| 237 | loop:
|
|---|
| 238 | StrCmp $1 "" done
|
|---|
| 239 | DetailPrint "Patching $1..."
|
|---|
| 240 |
|
|---|
| 241 | push "$2\lib\$1"
|
|---|
| 242 | push $3
|
|---|
| 243 | push $2
|
|---|
| 244 | call PatchPath
|
|---|
| 245 |
|
|---|
| 246 | FindNext $0 $1
|
|---|
| 247 | Goto loop
|
|---|
| 248 | done:
|
|---|
| 249 | pop $1
|
|---|
| 250 | pop $0
|
|---|
| 251 | pop $3
|
|---|
| 252 | pop $2
|
|---|
| 253 | FunctionEnd
|
|---|
| 254 |
|
|---|
| 255 | #
|
|---|
| 256 | # patch line in text files
|
|---|
| 257 | # push "qtcore4.prl" #Filename
|
|---|
| 258 | # push "#define ..." #START WITH
|
|---|
| 259 | # push "c:\qt" #REPLACE WITH
|
|---|
| 260 | # call PatchLine
|
|---|
| 261 | #
|
|---|
| 262 | Function PatchLine
|
|---|
| 263 | exch $2 ;replacement line
|
|---|
| 264 | exch 2
|
|---|
| 265 | exch $1 ;Filename
|
|---|
| 266 | exch
|
|---|
| 267 | exch $0 ;start with
|
|---|
| 268 | push $3 ; tmp filename
|
|---|
| 269 | push $4 ; handle (tmp)
|
|---|
| 270 | push $5 ; handle (org)
|
|---|
| 271 | push $6 ; string
|
|---|
| 272 |
|
|---|
| 273 | ClearErrors
|
|---|
| 274 | GetTempFileName $3
|
|---|
| 275 | IfErrors done
|
|---|
| 276 | FileOpen $4 $3 w
|
|---|
| 277 | IfErrors done
|
|---|
| 278 | FileOpen $5 $1 r
|
|---|
| 279 | IfErrors done
|
|---|
| 280 |
|
|---|
| 281 | nextline:
|
|---|
| 282 | FileRead $5 $6
|
|---|
| 283 | IfErrors renameFile
|
|---|
| 284 | push $6
|
|---|
| 285 | push $0
|
|---|
| 286 | push $2
|
|---|
| 287 | call ReplaceLine
|
|---|
| 288 | pop $6
|
|---|
| 289 | FileWrite $4 $6
|
|---|
| 290 | goto nextline
|
|---|
| 291 |
|
|---|
| 292 | renameFile:
|
|---|
| 293 | FileClose $4
|
|---|
| 294 | FileClose $5
|
|---|
| 295 | SetDetailsPrint none
|
|---|
| 296 | Delete $1
|
|---|
| 297 | Rename $3 $1
|
|---|
| 298 | SetDetailsPrint both
|
|---|
| 299 |
|
|---|
| 300 | done:
|
|---|
| 301 | pop $6
|
|---|
| 302 | pop $5
|
|---|
| 303 | pop $4
|
|---|
| 304 | pop $3
|
|---|
| 305 | pop $0
|
|---|
| 306 | pop $1
|
|---|
| 307 | pop $2
|
|---|
| 308 | FunctionEnd
|
|---|
| 309 |
|
|---|
| 310 | #
|
|---|
| 311 | # replaces a string that starts with something, with another string
|
|---|
| 312 | # push string
|
|---|
| 313 | # push "#define ..." #START WITH
|
|---|
| 314 | # push "c:\qt" #REPLACE WITH
|
|---|
| 315 | # call ReplaceLine
|
|---|
| 316 | # pop $0 #new string
|
|---|
| 317 | #
|
|---|
| 318 | Function ReplaceLine
|
|---|
| 319 | exch $2 ;new line
|
|---|
| 320 | exch 2
|
|---|
| 321 | exch $1 ;string
|
|---|
| 322 | exch
|
|---|
| 323 | exch $0 ;start with
|
|---|
| 324 |
|
|---|
| 325 | push $3 ; tmp string
|
|---|
| 326 | push $4 ; counter
|
|---|
| 327 | push $5 ; strlen
|
|---|
| 328 |
|
|---|
| 329 | StrCpy $4 "-1"
|
|---|
| 330 | StrLen $5 $1
|
|---|
| 331 |
|
|---|
| 332 | loop:
|
|---|
| 333 | IntOp $4 $4 + 1 ;increase counter
|
|---|
| 334 | StrCpy $3 $1 $4 ;get substring
|
|---|
| 335 | IntCmp $4 $5 copystring ; check for end
|
|---|
| 336 | StrCmp $3 $0 done ;start with found
|
|---|
| 337 | goto loop
|
|---|
| 338 |
|
|---|
| 339 | copystring:
|
|---|
| 340 | StrCpy $2 $1
|
|---|
| 341 | goto done
|
|---|
| 342 |
|
|---|
| 343 | done:
|
|---|
| 344 | pop $5
|
|---|
| 345 | pop $4
|
|---|
| 346 | pop $3
|
|---|
| 347 | pop $0
|
|---|
| 348 | pop $1
|
|---|
| 349 | exch $2
|
|---|
| 350 | FunctionEnd
|
|---|
| 351 |
|
|---|
| 352 | #
|
|---|
| 353 | # patch paths in text files
|
|---|
| 354 | # push "qtcore4.prl" #Filename
|
|---|
| 355 | # push "c:\compile" #OLD_QTDIR
|
|---|
| 356 | # push "c:\qt" #QTDIR
|
|---|
| 357 | # call PatchPath
|
|---|
| 358 | #
|
|---|
| 359 | Function PatchPath
|
|---|
| 360 | exch $2 ;NEW
|
|---|
| 361 | exch 2
|
|---|
| 362 | exch $1 ;Filename
|
|---|
| 363 | exch
|
|---|
| 364 | exch $0 ;OLD
|
|---|
| 365 | push $3 ;readline
|
|---|
| 366 | push $4 ;file 1
|
|---|
| 367 | push $5 ;file 2
|
|---|
| 368 | push $6 ;tmpfilename
|
|---|
| 369 |
|
|---|
| 370 | push $7 ;forward slash NEW
|
|---|
| 371 | push $8 ;forward slash OLD
|
|---|
| 372 |
|
|---|
| 373 | push $2
|
|---|
| 374 | push "\"
|
|---|
| 375 | push "/"
|
|---|
| 376 | call ReplaceString
|
|---|
| 377 | pop $7
|
|---|
| 378 |
|
|---|
| 379 | push $0
|
|---|
| 380 | push "\"
|
|---|
| 381 | push "/"
|
|---|
| 382 | call ReplaceString
|
|---|
| 383 | pop $8
|
|---|
| 384 |
|
|---|
| 385 | ClearErrors
|
|---|
| 386 | GetTempFileName $6
|
|---|
| 387 | IfErrors done
|
|---|
| 388 | FileOpen $5 $6 w
|
|---|
| 389 | IfErrors done
|
|---|
| 390 | FileOpen $4 $1 r
|
|---|
| 391 | IfErrors done
|
|---|
| 392 |
|
|---|
| 393 | nextline:
|
|---|
| 394 | FileRead $4 $3
|
|---|
| 395 | IfErrors renameFile
|
|---|
| 396 | push $3
|
|---|
| 397 | push $0
|
|---|
| 398 | push $2
|
|---|
| 399 | call ReplaceString ;replace backward slash path
|
|---|
| 400 | push $8
|
|---|
| 401 | push $7
|
|---|
| 402 | call ReplaceString ;replace forward slash path
|
|---|
| 403 | pop $3
|
|---|
| 404 | FileWrite $5 $3
|
|---|
| 405 | goto nextline
|
|---|
| 406 |
|
|---|
| 407 | renameFile:
|
|---|
| 408 | FileClose $5
|
|---|
| 409 | FileClose $4
|
|---|
| 410 | SetDetailsPrint none
|
|---|
| 411 | Delete $1
|
|---|
| 412 | Rename $6 $1
|
|---|
| 413 | SetDetailsPrint both
|
|---|
| 414 |
|
|---|
| 415 | done:
|
|---|
| 416 | pop $8
|
|---|
| 417 | pop $7
|
|---|
| 418 | pop $6
|
|---|
| 419 | pop $5
|
|---|
| 420 | pop $4
|
|---|
| 421 | pop $3
|
|---|
| 422 | pop $0
|
|---|
| 423 | pop $1
|
|---|
| 424 | pop $2
|
|---|
| 425 | FunctionEnd
|
|---|
| 426 |
|
|---|
| 427 | #
|
|---|
| 428 | # replaces a string with another string
|
|---|
| 429 | # push string
|
|---|
| 430 | # push "c:\qt" #replace
|
|---|
| 431 | # push "c:\compile" #with
|
|---|
| 432 | # call ReplaceString
|
|---|
| 433 | # pop $0 #new string
|
|---|
| 434 | #
|
|---|
| 435 | !macro ReplaceString UN
|
|---|
| 436 | Function ${UN}ReplaceString
|
|---|
| 437 | exch $2 ;NEW
|
|---|
| 438 | exch 2
|
|---|
| 439 | exch $1 ;string
|
|---|
| 440 | exch
|
|---|
| 441 | exch $0 ;OLD
|
|---|
| 442 |
|
|---|
| 443 | push $3 ; tmp string
|
|---|
| 444 | push $4 ; counter
|
|---|
| 445 | push $5 ; result
|
|---|
| 446 |
|
|---|
| 447 | push $6 ; old strlen
|
|---|
| 448 |
|
|---|
| 449 | StrCpy $4 "-1"
|
|---|
| 450 | StrCpy $5 ""
|
|---|
| 451 |
|
|---|
| 452 | StrLen $6 $0
|
|---|
| 453 |
|
|---|
| 454 | loop:
|
|---|
| 455 | IntOp $4 $4 + 1 ;increase counter
|
|---|
| 456 | StrCpy $3 $1 $6 $4 ;get substring
|
|---|
| 457 | StrCmp $3 "" done ; check for end
|
|---|
| 458 | StrCmp $3 $0 replace ;replace if old
|
|---|
| 459 | StrCpy $3 $1 "1" $4
|
|---|
| 460 | StrCpy $5 $5$3 ;append character to result
|
|---|
| 461 | goto loop
|
|---|
| 462 |
|
|---|
| 463 | replace:
|
|---|
| 464 | StrCpy $5 $5$2 ;insert new qtdir
|
|---|
| 465 | IntOp $4 $4 + $6 ;increase offset
|
|---|
| 466 | IntOp $4 $4 - 1 ;decrease offset one more
|
|---|
| 467 | goto loop
|
|---|
| 468 |
|
|---|
| 469 | done:
|
|---|
| 470 | StrCpy $2 $5
|
|---|
| 471 | pop $6
|
|---|
| 472 | pop $5
|
|---|
| 473 | pop $4
|
|---|
| 474 | pop $3
|
|---|
| 475 | pop $0
|
|---|
| 476 | pop $1
|
|---|
| 477 | exch $2
|
|---|
| 478 | FunctionEnd
|
|---|
| 479 | !macroend
|
|---|
| 480 | !insertmacro ReplaceString ""
|
|---|
| 481 | !insertmacro ReplaceString "un."
|
|---|
| 482 |
|
|---|
| 483 | Function CommonCheckDirectory
|
|---|
| 484 | exch $4
|
|---|
| 485 | exch
|
|---|
| 486 | exch $5
|
|---|
| 487 | push $0
|
|---|
| 488 | push $1
|
|---|
| 489 | push $2
|
|---|
| 490 | push $3
|
|---|
| 491 |
|
|---|
| 492 | ; check if qt is already installed
|
|---|
| 493 | IfFileExists "$4\bin\qmake.exe" 0 +2
|
|---|
| 494 | IfFileExists "$4\uninst.exe" qtExistsError
|
|---|
| 495 |
|
|---|
| 496 | ; check if directory is empty
|
|---|
| 497 | FindFirst $0 $1 "$4\*"
|
|---|
| 498 | CommonCheckDirectory_FileSearchLoop:
|
|---|
| 499 | StrCmp $1 "" CommonCheckDirectory_DirDoesNotExist
|
|---|
| 500 | StrCmp $1 "." CommonCheckDirectory_ContinueSearchLoop
|
|---|
| 501 | StrCmp $1 ".." CommonCheckDirectory_ContinueSearchLoop
|
|---|
| 502 | goto CommonCheckDirectory_FoundFile
|
|---|
| 503 | CommonCheckDirectory_ContinueSearchLoop:
|
|---|
| 504 | FindNext $0 $1
|
|---|
| 505 | goto CommonCheckDirectory_FileSearchLoop
|
|---|
| 506 |
|
|---|
| 507 | CommonCheckDirectory_FoundFile:
|
|---|
| 508 | FindClose $0
|
|---|
| 509 | MessageBox MB_YESNO|MB_ICONEXCLAMATION "This directory already has contents. Are you sure you want to use this directory?" IDYES CommonCheckDirectory_DirDoesNotExist
|
|---|
| 510 | Goto errorInDirectory
|
|---|
| 511 | CommonCheckDirectory_DirDoesNotExist:
|
|---|
| 512 | FindClose $0
|
|---|
| 513 |
|
|---|
| 514 | GetInstDirError $0
|
|---|
| 515 | IntCmp 0 $0 0 instDirError
|
|---|
| 516 |
|
|---|
| 517 | StrLen $0 $4
|
|---|
| 518 |
|
|---|
| 519 | !ifdef USE_NODIRLENGTHCHECK
|
|---|
| 520 | StrCpy $1 "400"
|
|---|
| 521 | !else
|
|---|
| 522 | StrLen $1 $5
|
|---|
| 523 | !endif
|
|---|
| 524 |
|
|---|
| 525 | IntCmp $1 $0 0 directoryToLong
|
|---|
| 526 |
|
|---|
| 527 | ;check for spaces
|
|---|
| 528 | StrCpy $2 "-1"
|
|---|
| 529 | StrCpy $3 ""
|
|---|
| 530 |
|
|---|
| 531 | loop:
|
|---|
| 532 | IntOp $2 $2 + 1 ;increase counter
|
|---|
| 533 | StrCpy $3 $4 "1" $2 ;get char
|
|---|
| 534 | StrCmp $3 "" directoryOk ; check for end
|
|---|
| 535 | StrCmp $3 " " spaceInDirectory ;check for space
|
|---|
| 536 | goto loop
|
|---|
| 537 |
|
|---|
| 538 | qtExistsError:
|
|---|
| 539 | MessageBox MB_OK|MB_ICONEXCLAMATION "Qt is already installed in this directory. Please uninstall the previous version and try again."
|
|---|
| 540 | Goto errorInDirectory
|
|---|
| 541 |
|
|---|
| 542 | instDirError:
|
|---|
| 543 | MessageBox MB_OK|MB_ICONEXCLAMATION "This is not a valid installation directory."
|
|---|
| 544 | Goto errorInDirectory
|
|---|
| 545 |
|
|---|
| 546 | spaceInDirectory:
|
|---|
| 547 | MessageBox MB_OK|MB_ICONEXCLAMATION "The installation path can't contain spaces."
|
|---|
| 548 | Goto errorInDirectory
|
|---|
| 549 |
|
|---|
| 550 | directoryToLong:
|
|---|
| 551 | MessageBox MB_OK|MB_ICONEXCLAMATION "The installation directory is to long."
|
|---|
| 552 | Goto errorInDirectory
|
|---|
| 553 |
|
|---|
| 554 | errorInDirectory:
|
|---|
| 555 | pop $3
|
|---|
| 556 | pop $2
|
|---|
| 557 | pop $1
|
|---|
| 558 | pop $0
|
|---|
| 559 | pop $5
|
|---|
| 560 | pop $4
|
|---|
| 561 | Abort
|
|---|
| 562 | goto done
|
|---|
| 563 |
|
|---|
| 564 | directoryOk:
|
|---|
| 565 | pop $3
|
|---|
| 566 | pop $2
|
|---|
| 567 | pop $1
|
|---|
| 568 | pop $0
|
|---|
| 569 | pop $5
|
|---|
| 570 | pop $4
|
|---|
| 571 | done:
|
|---|
| 572 | FunctionEnd
|
|---|
| 573 |
|
|---|
| 574 | !endif ;QTCOMMON_INCLUDE
|
|---|