No more problems for directories with a name starting with "error"

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2096 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-01-30 18:42:36 +00:00
parent 9892281211
commit 37a03e4fac
5 changed files with 27 additions and 14 deletions

View file

@ -1088,6 +1088,8 @@
!endif !endif
Function "${SETSTARTMENU}" Function "${SETSTARTMENU}"
Push ${MUI_TEMP1}
!insertmacro MUI_HEADER_TEXT $(MUI_TEXT_STARTMENU_TITLE) $(MUI_TEXT_STARTMENU_SUBTITLE) !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_STARTMENU_TITLE) $(MUI_TEXT_STARTMENU_SUBTITLE)
@ -1095,21 +1097,23 @@
!ifdef MUI_STARTMENU_REGISTRY_KEY !ifdef MUI_STARTMENU_REGISTRY_KEY
!ifdef MUI_STARTMENU_REGISTRY_VALUENAME !ifdef MUI_STARTMENU_REGISTRY_VALUENAME
StrCmp "${MUI_STARTMENU_VARIABLE}" "" "" +6 StrCmp "${MUI_STARTMENU_VARIABLE}" "" "" +4
Push ${MUI_TEMP1}
ReadRegStr ${MUI_TEMP1} "${MUI_STARTMENU_REGISTRY_ROOT}" "${MUI_STARTMENU_REGISTRY_KEY}" "${MUI_STARTMENU_REGISTRY_VALUENAME}" ReadRegStr ${MUI_TEMP1} "${MUI_STARTMENU_REGISTRY_ROOT}" "${MUI_STARTMENU_REGISTRY_KEY}" "${MUI_STARTMENU_REGISTRY_VALUENAME}"
StrCmp ${MUI_TEMP1} "" +2 StrCmp ${MUI_TEMP1} "" +2
StrCpy "${MUI_STARTMENU_VARIABLE}" ${MUI_TEMP1} StrCpy "${MUI_STARTMENU_VARIABLE}" ${MUI_TEMP1}
Pop ${MUI_TEMP1}
!endif !endif
!endif !endif
!endif !endif
StartMenu::Select /noicon /autoadd /text "$(MUI_INNERTEXT_STARTMENU_TOP)" /lastused "${MUI_STARTMENU_VARIABLE}" /checknoshortcuts "$(MUI_INNERTEXT_STARTMENU_CHECKBOX)" "${MUI_STARTMENU_DEFAULTFOLDER}" StartMenu::Select /noicon /autoadd /text "$(MUI_INNERTEXT_STARTMENU_TOP)" /lastused "${MUI_STARTMENU_VARIABLE}" /checknoshortcuts "$(MUI_INNERTEXT_STARTMENU_CHECKBOX)" "${MUI_STARTMENU_DEFAULTFOLDER}"
Pop "${MUI_STARTMENU_VARIABLE}" Pop ${MUI_TEMP1}
StrCmp ${MUI_TEMP1} "success" 0 +2
Pop "${MUI_STARTMENU_VARIABLE}"
Pop ${MUI_TEMP1}
FunctionEnd FunctionEnd
!ifndef MUI_NOVERBOSE !ifndef MUI_NOVERBOSE

View file

@ -15,16 +15,21 @@ FunctionEnd
Page custom StartMenuGroupSelect ": Start Menu Folder" Page custom StartMenuGroupSelect ": Start Menu Folder"
Function StartMenuGroupSelect Function StartMenuGroupSelect
Push $R1
StartMenu::Select /checknoshortcuts "Don't create a start menu folder" /autoadd /lastused $R0 "StartMenu.dll test" StartMenu::Select /checknoshortcuts "Don't create a start menu folder" /autoadd /lastused $R0 "StartMenu.dll test"
Pop $R1 Pop $R1
StrCpy $R2 $R1 5 StrCmp $R1 "success" success
StrCmp $R2 "error" 0 +3 StrCmp $R1 "cancel" done
; error ; error
MessageBox MB_OK $R1 MessageBox MB_OK $R1
Return Return
StrCpy $R0 $R1 ; got the dir, or cancel, but if it's cancel NSIS will exit and success:
; then we shouldn't care about the value of $R0 Pop $R0
done:
Pop $R1
FunctionEnd FunctionEnd
Page instfiles Page instfiles

View file

@ -15,9 +15,12 @@ which is the program group default name, and some more optional parameters:
will have > as its first character and you will have > as its first character and you
should not create the program group. should not create the program group.
The function pushes the folder selection back to the stack. It does not push the The function pushes "success", "cancel" or an error to the stack. If there was no
full path but only the selected sub-folder. It's up to you to decide if to put error and the user didn't press on cancel it will push the selected folder name
it in the current user or all users start menu. after "success". If the user checked the no shortcuts checkbox the '>' will be
appended to the folder name. The function does not push the full path but only the
selected sub-folder. It's up to you to decide if to put it in the current user or
all users start menu.
Look at Example.nsi for an example. Look at Example.nsi for an example.

View file

@ -285,6 +285,7 @@ BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
else *buf = 0; else *buf = 0;
GetWindowText(hwLocation, buf + (*buf ? 1 : 0), MAX_PATH); GetWindowText(hwLocation, buf + (*buf ? 1 : 0), MAX_PATH);
pushstring(buf); pushstring(buf);
pushstring("success");
} }
break; break;
} }

Binary file not shown.