Merge branch 'master' of github.com:royqh1979/RedPanda-CPP

This commit is contained in:
Roy Qu 2024-03-30 17:55:55 +08:00
commit 97f4e93df3
1 changed files with 57 additions and 51 deletions

View File

@ -7,12 +7,24 @@ Unicode True
!define APP_NAME_ZH_CN "小熊猫 C++" !define APP_NAME_ZH_CN "小熊猫 C++"
!define DISPLAY_NAME "$(StrAppName) ${APP_VERSION} (${ARCH})" !define DISPLAY_NAME "$(StrAppName) ${APP_VERSION} (${ARCH})"
!define INSTALL_NAME "RedPanda-Cpp"
!define REGISTRY_PROGRAM_ID "RedPanda-C++" !define REGISTRY_PROGRAM_ID "RedPanda-C++"
!define UNINSTKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${REGISTRY_PROGRAM_ID}" !define UNINSTKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${REGISTRY_PROGRAM_ID}"
!define MULTIUSER_EXECUTIONLEVEL Highest
!define MULTIUSER_INSTALLMODE_COMMANDLINE
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "${UNINSTKEY}"
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "CurrentUser"
!define MULTIUSER_INSTALLMODE_INSTDIR "${INSTALL_NAME}"
!define MULTIUSER_MUI
!if "${ARCH}" != "x86"
!define MULTIUSER_USE_PROGRAMFILES64
!endif
!include "Integration.nsh" !include "Integration.nsh"
!include "LogicLib.nsh" !include "LogicLib.nsh"
!include "MUI2.nsh" !include "MUI2.nsh"
!include "MultiUser.nsh"
!include "WinVer.nsh" !include "WinVer.nsh"
!include "WordFunc.nsh" !include "WordFunc.nsh"
!include "x64.nsh" !include "x64.nsh"
@ -30,11 +42,7 @@ OutFile "${FINALNAME}"
Caption "${DISPLAY_NAME}" Caption "${DISPLAY_NAME}"
LicenseData "LICENSE" LicenseData "LICENSE"
!if "${ARCH}" == "x86"
InstallDir $PROGRAMFILES\RedPanda-Cpp
!else
InstallDir $PROGRAMFILES64\RedPanda-Cpp
!endif
#################################################################### ####################################################################
# Interface Settings # Interface Settings
@ -54,11 +62,6 @@ InstType "$(StrInstTypeFull)" ;1
InstType "$(StrInstTypeMinimal)" ;2 InstType "$(StrInstTypeMinimal)" ;2
InstType "$(StrInstTypeSafe)" ;3 InstType "$(StrInstTypeSafe)" ;3
## Remember the installer language
!define MUI_LANGDLL_REGISTRY_ROOT "ShCtx"
!define MUI_LANGDLL_REGISTRY_KEY "Software\RedPanda-C++"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
#################################################################### ####################################################################
# Pages # Pages
@ -71,6 +74,7 @@ InstType "$(StrInstTypeSafe)" ;3
!define MUI_COMPONENTSPAGE_SMALLDESC !define MUI_COMPONENTSPAGE_SMALLDESC
!insertmacro MUI_PAGE_LICENSE "LICENSE" !insertmacro MUI_PAGE_LICENSE "LICENSE"
!insertmacro MULTIUSER_PAGE_INSTALLMODE
!insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_INSTFILES
@ -108,7 +112,7 @@ Section "$(SectionMainName)" SectionMain
WriteRegStr ShCtx "${UNINSTKEY}" "DisplayVersion" "${APP_VERSION}" WriteRegStr ShCtx "${UNINSTKEY}" "DisplayVersion" "${APP_VERSION}"
WriteRegStr ShCtx "${UNINSTKEY}" "DisplayIcon" "$INSTDIR\RedPandaIDE.exe" WriteRegStr ShCtx "${UNINSTKEY}" "DisplayIcon" "$INSTDIR\RedPandaIDE.exe"
WriteRegStr ShCtx "${UNINSTKEY}" "Publisher" "Roy Qu (royqh1979@gmail.com)" WriteRegStr ShCtx "${UNINSTKEY}" "Publisher" "Roy Qu (royqh1979@gmail.com)"
WriteRegStr ShCtx "${UNINSTKEY}" "$MultiUser.InstallMode" "1"
; Write required files ; Write required files
File "RedPandaIDE.exe" File "RedPandaIDE.exe"
@ -151,10 +155,10 @@ Section "$(SectionAssocExtNameBegin) .dev $(SectionAssocExtNameEnd)"
SectionIn 1 3 SectionIn 1 3
StrCpy $0 $INSTDIR\RedPandaIDE.exe StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr HKCR ".dev" "" "DevCpp.dev" WriteRegStr ShCtx "Software\Classes\.dev" "" "DevCpp.dev"
WriteRegStr HKCR "DevCpp.dev" "" "$(StrAppName) $(StrProjectFile)" WriteRegStr ShCtx "Software\Classes\DevCpp.dev" "" "$(StrAppName) $(StrProjectFile)"
WriteRegStr HKCR "DevCpp.dev\DefaultIcon" "" '$0,3' WriteRegStr ShCtx "Software\Classes\DevCpp.dev\DefaultIcon" "" '$0,3'
WriteRegStr HKCR "DevCpp.dev\Shell\Open\Command" "" '$0 "%1"' WriteRegStr ShCtx "Software\Classes\DevCpp.dev\Shell\Open\Command" "" '$0 "%1"'
${NotifyShell_AssocChanged} ${NotifyShell_AssocChanged}
SectionEnd SectionEnd
@ -162,10 +166,10 @@ Section "$(SectionAssocExtNameBegin) .c $(SectionAssocExtNameEnd)"
SectionIn 1 3 SectionIn 1 3
StrCpy $0 $INSTDIR\RedPandaIDE.exe StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr HKCR ".c" "" "DevCpp.c" WriteRegStr ShCtx "Software\Classes\.c" "" "DevCpp.c"
WriteRegStr HKCR "DevCpp.c" "" "C $(StrSourceFile)" WriteRegStr ShCtx "Software\Classes\DevCpp.c" "" "C $(StrSourceFile)"
WriteRegStr HKCR "DevCpp.c\DefaultIcon" "" '$0,4' WriteRegStr ShCtx "Software\Classes\DevCpp.c\DefaultIcon" "" '$0,4'
WriteRegStr HKCR "DevCpp.c\Shell\Open\Command" "" '$0 "%1"' WriteRegStr ShCtx "Software\Classes\DevCpp.c\Shell\Open\Command" "" '$0 "%1"'
${NotifyShell_AssocChanged} ${NotifyShell_AssocChanged}
SectionEnd SectionEnd
@ -173,10 +177,10 @@ Section "$(SectionAssocExtNameBegin) .cpp $(SectionAssocExtNameEnd)"
SectionIn 1 3 SectionIn 1 3
StrCpy $0 $INSTDIR\RedPandaIDE.exe StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr HKCR ".cpp" "" "DevCpp.cpp" WriteRegStr ShCtx "Software\Classes\.cpp" "" "DevCpp.cpp"
WriteRegStr HKCR "DevCpp.cpp" "" "C++ $(StrSourceFile)" WriteRegStr ShCtx "Software\Classes\DevCpp.cpp" "" "C++ $(StrSourceFile)"
WriteRegStr HKCR "DevCpp.cpp\DefaultIcon" "" '$0,5' WriteRegStr ShCtx "Software\Classes\DevCpp.cpp\DefaultIcon" "" '$0,5'
WriteRegStr HKCR "DevCpp.cpp\Shell\Open\Command" "" '$0 "%1"' WriteRegStr ShCtx "Software\Classes\DevCpp.cpp\Shell\Open\Command" "" '$0 "%1"'
${NotifyShell_AssocChanged} ${NotifyShell_AssocChanged}
SectionEnd SectionEnd
@ -184,10 +188,10 @@ Section "$(SectionAssocExtNameBegin) .cxx $(SectionAssocExtNameEnd)"
SectionIn 1 3 SectionIn 1 3
StrCpy $0 $INSTDIR\RedPandaIDE.exe StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr HKCR ".cxx" "" "DevCpp.cxx" WriteRegStr ShCtx "Software\Classes\.cxx" "" "DevCpp.cxx"
WriteRegStr HKCR "DevCpp.cxx" "" "C++ $(StrSourceFile)" WriteRegStr ShCtx "Software\Classes\DevCpp.cxx" "" "C++ $(StrSourceFile)"
WriteRegStr HKCR "DevCpp.cxx\DefaultIcon" "" '$0,5' WriteRegStr ShCtx "Software\Classes\DevCpp.cxx\DefaultIcon" "" '$0,5'
WriteRegStr HKCR "DevCpp.cxx\Shell\Open\Command" "" '$0 "%1"' WriteRegStr ShCtx "Software\Classes\DevCpp.cxx\Shell\Open\Command" "" '$0 "%1"'
${NotifyShell_AssocChanged} ${NotifyShell_AssocChanged}
SectionEnd SectionEnd
@ -195,10 +199,10 @@ Section "$(SectionAssocExtNameBegin) .cc $(SectionAssocExtNameEnd)"
SectionIn 1 3 SectionIn 1 3
StrCpy $0 $INSTDIR\RedPandaIDE.exe StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr HKCR ".cc" "" "DevCpp.cc" WriteRegStr ShCtx "Software\Classes\.cc" "" "DevCpp.cc"
WriteRegStr HKCR "DevCpp.cc" "" "C++ $(StrSourceFile)" WriteRegStr ShCtx "Software\Classes\DevCpp.cc" "" "C++ $(StrSourceFile)"
WriteRegStr HKCR "DevCpp.cc\DefaultIcon" "" '$0,5' WriteRegStr ShCtx "Software\Classes\DevCpp.cc\DefaultIcon" "" '$0,5'
WriteRegStr HKCR "DevCpp.cc\Shell\Open\Command" "" '$0 "%1"' WriteRegStr ShCtx "Software\Classes\DevCpp.cc\Shell\Open\Command" "" '$0 "%1"'
${NotifyShell_AssocChanged} ${NotifyShell_AssocChanged}
SectionEnd SectionEnd
@ -206,10 +210,10 @@ Section "$(SectionAssocExtNameBegin) .hxx $(SectionAssocExtNameEnd)"
SectionIn 1 3 SectionIn 1 3
StrCpy $0 $INSTDIR\RedPandaIDE.exe StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr HKCR ".hxx" "" "DevCpp.hxx" WriteRegStr ShCtx "Software\Classes\.hxx" "" "DevCpp.hxx"
WriteRegStr HKCR "DevCpp.hxx" "" "C++ $(StrHeaderFile)" WriteRegStr ShCtx "Software\Classes\DevCpp.hxx" "" "C++ $(StrHeaderFile)"
WriteRegStr HKCR "DevCpp.hxx\DefaultIcon" "" '$0,7' WriteRegStr ShCtx "Software\Classes\DevCpp.hxx\DefaultIcon" "" '$0,7'
WriteRegStr HKCR "DevCpp.hxx\Shell\Open\Command" "" '$0 "%1"' WriteRegStr ShCtx "Software\Classes\DevCpp.hxx\Shell\Open\Command" "" '$0 "%1"'
${NotifyShell_AssocChanged} ${NotifyShell_AssocChanged}
SectionEnd SectionEnd
@ -217,10 +221,10 @@ Section "$(SectionAssocExtNameBegin) .h $(SectionAssocExtNameEnd)"
SectionIn 1 3 SectionIn 1 3
StrCpy $0 $INSTDIR\RedPandaIDE.exe StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr HKCR ".h" "" "DevCpp.h" WriteRegStr ShCtx "Software\Classes\.h" "" "DevCpp.h"
WriteRegStr HKCR "DevCpp.h" "" "C $(StrHeaderFile)" WriteRegStr ShCtx "Software\Classes\DevCpp.h" "" "C $(StrHeaderFile)"
WriteRegStr HKCR "DevCpp.h\DefaultIcon" "" '$0,6' WriteRegStr ShCtx "Software\Classes\DevCpp.h\DefaultIcon" "" '$0,6'
WriteRegStr HKCR "DevCpp.h\Shell\Open\Command" "" '$0 "%1"' WriteRegStr ShCtx "Software\Classes\DevCpp.h\Shell\Open\Command" "" '$0 "%1"'
${NotifyShell_AssocChanged} ${NotifyShell_AssocChanged}
SectionEnd SectionEnd
@ -228,10 +232,10 @@ Section "$(SectionAssocExtNameBegin) .hpp $(SectionAssocExtNameEnd)"
SectionIn 1 3 SectionIn 1 3
StrCpy $0 $INSTDIR\RedPandaIDE.exe StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr HKCR ".hpp" "" "DevCpp.hpp" WriteRegStr ShCtx "Software\Classes\.hpp" "" "DevCpp.hpp"
WriteRegStr HKCR "DevCpp.hpp" "" "C++ $(StrHeaderFile)" WriteRegStr ShCtx "Software\Classes\DevCpp.hpp" "" "C++ $(StrHeaderFile)"
WriteRegStr HKCR "DevCpp.hpp\DefaultIcon" "" '$0,7' WriteRegStr ShCtx "Software\Classes\DevCpp.hpp\DefaultIcon" "" '$0,7'
WriteRegStr HKCR "DevCpp.hpp\Shell\Open\Command" "" '$0 "%1"' WriteRegStr ShCtx "Software\Classes\DevCpp.hpp\Shell\Open\Command" "" '$0 "%1"'
${NotifyShell_AssocChanged} ${NotifyShell_AssocChanged}
SectionEnd SectionEnd
@ -291,6 +295,7 @@ SectionEnd
# Functions, utilities # Functions, utilities
Function .onInit Function .onInit
!insertmacro MULTIUSER_INIT
!insertmacro MUI_LANGDLL_DISPLAY !insertmacro MUI_LANGDLL_DISPLAY
!insertmacro DetectOsArch !insertmacro DetectOsArch
@ -323,6 +328,7 @@ Function myGuiInit
FunctionEnd FunctionEnd
Function un.onInit Function un.onInit
!insertmacro MULTIUSER_UNINIT
!insertmacro MUI_UNGETLANGUAGE !insertmacro MUI_UNGETLANGUAGE
SetShellVarContext all SetShellVarContext all
@ -395,14 +401,14 @@ Section "Uninstall"
Delete "$DESKTOP\${APP_NAME_EN}.lnk" Delete "$DESKTOP\${APP_NAME_EN}.lnk"
Delete "$DESKTOP\${APP_NAME_ZH_CN}.lnk" Delete "$DESKTOP\${APP_NAME_ZH_CN}.lnk"
DeleteRegKey HKCR "DevCpp.dev" DeleteRegKey ShCtx "Software\Classes\DevCpp.dev"
DeleteRegKey HKCR "DevCpp.c" DeleteRegKey ShCtx "Software\Classes\DevCpp.c"
DeleteRegKey HKCR "DevCpp.cpp" DeleteRegKey ShCtx "Software\Classes\DevCpp.cpp"
DeleteRegKey HKCR "DevCpp.cxx" DeleteRegKey ShCtx "Software\Classes\DevCpp.cxx"
DeleteRegKey HKCR "DevCpp.cc" DeleteRegKey ShCtx "Software\Classes\DevCpp.cc"
DeleteRegKey HKCR "DevCpp.h" DeleteRegKey ShCtx "Software\Classes\DevCpp.h"
DeleteRegKey HKCR "DevCpp.hpp" DeleteRegKey ShCtx "Software\Classes\DevCpp.hpp"
DeleteRegKey HKCR "DevCpp.hxx" DeleteRegKey ShCtx "Software\Classes\DevCpp.hxx"
${NotifyShell_AssocChanged} ${NotifyShell_AssocChanged}
Delete "$INSTDIR\NEWS.md" Delete "$INSTDIR\NEWS.md"