Rev 73 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 73 | Rev 76 | ||
---|---|---|---|
Line 21... | Line 21... | ||
21 | !define MUI_HEADERIMAGE_BITMAP "${INSTALLER_SRC}\resource\installer.bmp" |
21 | !define MUI_HEADERIMAGE_BITMAP "${INSTALLER_SRC}\resource\installer.bmp" |
22 | !define MUI_ABORTWARNING |
22 | !define MUI_ABORTWARNING |
23 | 23 | ||
24 | !insertmacro MUI_PAGE_LICENSE "${INSTALLER_SRC}\License.txt" |
24 | !insertmacro MUI_PAGE_LICENSE "${INSTALLER_SRC}\License.txt" |
25 | !insertmacro MUI_PAGE_DIRECTORY |
25 | !insertmacro MUI_PAGE_DIRECTORY |
- | 26 | ||
- | 27 | Var STR_HAYSTACK |
|
- | 28 | Var STR_NEEDLE |
|
- | 29 | Var STR_CONTAINS_VAR_1 |
|
- | 30 | Var STR_CONTAINS_VAR_2 |
|
- | 31 | Var STR_CONTAINS_VAR_3 |
|
- | 32 | Var STR_CONTAINS_VAR_4 |
|
- | 33 | Var STR_RETURN_VAR |
|
- | 34 | ||
- | 35 | Function StrContains |
|
- | 36 | Exch $STR_NEEDLE |
|
- | 37 | Exch 1 |
|
- | 38 | Exch $STR_HAYSTACK |
|
- | 39 | StrCpy $STR_RETURN_VAR "" |
|
- | 40 | StrCpy $STR_CONTAINS_VAR_1 -1 |
|
- | 41 | StrLen $STR_CONTAINS_VAR_2 $STR_NEEDLE |
|
- | 42 | StrLen $STR_CONTAINS_VAR_4 $STR_HAYSTACK |
|
- | 43 | loop: |
|
- | 44 | IntOp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_1 + 1 |
|
- | 45 | StrCpy $STR_CONTAINS_VAR_3 $STR_HAYSTACK $STR_CONTAINS_VAR_2 $STR_CONTAINS_VAR_1 |
|
- | 46 | StrCmp $STR_CONTAINS_VAR_3 $STR_NEEDLE found |
|
- | 47 | StrCmp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_4 done |
|
- | 48 | Goto loop |
|
- | 49 | found: |
|
- | 50 | StrCpy $STR_RETURN_VAR $STR_NEEDLE |
|
- | 51 | Goto done |
|
- | 52 | done: |
|
- | 53 | Pop $STR_NEEDLE |
|
- | 54 | Exch $STR_RETURN_VAR |
|
- | 55 | FunctionEnd |
|
- | 56 | !macro _StrContainsConstructor OUT NEEDLE HAYSTACK |
|
- | 57 | Push `${HAYSTACK}` |
|
- | 58 | Push `${NEEDLE}` |
|
- | 59 | Call StrContains |
|
- | 60 | Pop `${OUT}` |
|
- | 61 | !macroend |
|
- | 62 | ||
- | 63 | !define StrContains '!insertmacro "_StrContainsConstructor"' |
|
- | 64 | ||
- | 65 | Function .onVerifyInstDir |
|
- | 66 | Push $R0 |
|
- | 67 | Push $R1 |
|
- | 68 | ${StrContains} $0 "Program Files" "$INSTDIR" |
|
- | 69 | StrCmp $0 "Program Files" pathbad |
|
- | 70 | StrCpy $R0 "$INSTDIR" |
|
- | 71 | loop: |
|
- | 72 | StrLen $R1 "$R0" |
|
- | 73 | StrCmp $R1 0 pathbad |
|
- | 74 | IfFileExists "$R0" 0 parentLoop |
|
- | 75 | ${GetFileAttributes} "$R0" "DIRECTORY" $R1 |
|
- | 76 | StrCmp $R1 0 parentLoop |
|
- | 77 | ${GetFileAttributes} "$R0" "READONLY" $R1 |
|
- | 78 | StrCmp $R1 1 pathbad |
|
- | 79 | ClearErrors |
|
- | 80 | IfFileExists "$R0\.nsis_test_dir" pathgood 0 |
|
- | 81 | CreateDirectory "$R0\.nsis_test_dir" |
|
- | 82 | IfErrors pathbad 0 |
|
- | 83 | RMDir "$R0\.nsis_test_dir" |
|
- | 84 | Goto pathgood |
|
- | 85 | parentLoop: |
|
- | 86 | ${GetParent} "$R0" "$R0" |
|
- | 87 | Goto loop |
|
- | 88 | pathbad: |
|
- | 89 | Abort |
|
- | 90 | pathgood: |
|
- | 91 | Pop $R1 |
|
- | 92 | Pop $R0 |
|
- | 93 | FunctionEnd |
|
- | 94 | ||
26 | ;!insertmacro MUI_PAGE_COMPONENTS |
95 | ;!insertmacro MUI_PAGE_COMPONENTS |
27 | !insertmacro MUI_PAGE_INSTFILES |
96 | !insertmacro MUI_PAGE_INSTFILES |
28 | AutoCloseWindow true |
97 | AutoCloseWindow true |
29 | 98 | ||
30 | !insertmacro MUI_UNPAGE_CONFIRM |
99 | !insertmacro MUI_UNPAGE_CONFIRM |