55!define PRODUCT_UNINST_KEY " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
66!define PRODUCT_UNINST_ROOT_KEY " HKLM"
77
8+ !include " x64.nsh"
9+
810!include " MUI2.nsh"
911
12+ ; MUI General Settings
1013!define MUI_ABORTWARNING
1114!define MUI_ICON " ..\res\Notepad4.ico"
12- ; !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\uninstall.ico"
15+ !define MUI_UNICON " ${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
16+ !define MUI_HEADERIMAGE
17+ !define MUI_HEADERIMAGE_BITMAP " ${NSISDIR}\Contrib\Graphics\Header\nsis.bmp"
18+ !define MUI_WELCOMEFINISHPAGE_BITMAP " ${NSISDIR}\Contrib\Graphics\Wizard\nsis.bmp"
19+ !define MUI_COMPONENTSPAGE_SMALLDESC
1320
21+ ; Page Settings
22+ !insertmacro MUI_PAGE_WELCOME
23+ !insertmacro MUI_PAGE_LICENSE " ..\License.txt"
24+ !insertmacro MUI_PAGE_COMPONENTS
1425!insertmacro MUI_PAGE_DIRECTORY
1526!insertmacro MUI_PAGE_INSTFILES
27+ !insertmacro MUI_PAGE_FINISH
1628
29+ ; Uninstall Page Settings
30+ !insertmacro MUI_UNPAGE_WELCOME
1731!insertmacro MUI_UNPAGE_CONFIRM
1832!insertmacro MUI_UNPAGE_INSTFILES
33+ !insertmacro MUI_UNPAGE_FINISH
1934
35+ ; Language Settings
2036!insertmacro MUI_LANGUAGE " English"
2137
2238Name " ${PRODUCT_NAME} ${PRODUCT_VERSION} (${ARCH})"
2339OutFile " ${OUTPUT_FILE}"
2440InstallDir " $PROGRAMFILES\${PRODUCT_NAME}"
2541InstallDirRegKey HKLM " ${PRODUCT_DIR_REGKEY}" " Path"
2642
27- Section " MainSection" SEC01
43+ ; Component page configuration
44+ !define MUI_COMPONENTSPAGE_NODESC
45+
46+ Section " Notepad4 Main Program" SEC_MAIN
47+ SectionIn RO
2848 SetOutPath " $INSTDIR"
49+ ; Use SOURCE_DIR variable passed from command line
2950 File " ${SOURCE_DIR}\Notepad4.exe"
3051 File " ${SOURCE_DIR}\matepath.exe"
3152
@@ -35,11 +56,76 @@ Section "MainSection" SEC01
3556 WriteUninstaller " $INSTDIR\uninstall.exe"
3657SectionEnd
3758
59+ Section " Language Packs" SEC_LOCALE
60+ ; Build locale path using ARCH variable
61+ ; Actual locale path: build\bin\Release\{platform}\locale\
62+
63+ ; Set base directory for locales
64+ !define LOCALE_BASE_DIR " ..\build\bin\Release"
65+
66+ ; Determine platform directory based on ARCH variable
67+ !ifdef ARCH
68+ !if " ${ARCH}" == " x86"
69+ !define PLATFORM_DIR " Win32"
70+ !elseif " ${ARCH}" == " x64"
71+ !define PLATFORM_DIR " x64"
72+ !elseif " ${ARCH}" == " arm64"
73+ !define PLATFORM_DIR " ARM64"
74+ !else
75+ !define PLATFORM_DIR " Win32"
76+ !endif
77+ !else
78+ !define PLATFORM_DIR " Win32"
79+ !endif
80+
81+ ; Build full locale directory path
82+ !define LOCALE_FULL_DIR " ${LOCALE_BASE_DIR}\${PLATFORM_DIR}\locale"
83+
84+ SetOutPath " $INSTDIR\locale\de"
85+ File /r " ${LOCALE_FULL_DIR}\de\*.dll"
86+
87+ SetOutPath " $INSTDIR\locale\fr"
88+ File /r " ${LOCALE_FULL_DIR}\fr\*.dll"
89+
90+ SetOutPath " $INSTDIR\locale\it"
91+ File /r " ${LOCALE_FULL_DIR}\it\*.dll"
92+
93+ SetOutPath " $INSTDIR\locale\ja"
94+ File /r " ${LOCALE_FULL_DIR}\ja\*.dll"
95+
96+ SetOutPath " $INSTDIR\locale\ko"
97+ File /r " ${LOCALE_FULL_DIR}\ko\*.dll"
98+
99+ SetOutPath " $INSTDIR\locale\pl"
100+ File /r " ${LOCALE_FULL_DIR}\pl\*.dll"
101+
102+ SetOutPath " $INSTDIR\locale\pt-BR"
103+ File /r " ${LOCALE_FULL_DIR}\pt-BR\*.dll"
104+
105+ SetOutPath " $INSTDIR\locale\ru"
106+ File /r " ${LOCALE_FULL_DIR}\ru\*.dll"
107+
108+ SetOutPath " $INSTDIR\locale\zh-Hans"
109+ File /r " ${LOCALE_FULL_DIR}\zh-Hans\*.dll"
110+
111+ SetOutPath " $INSTDIR\locale\zh-Hant"
112+ File /r " ${LOCALE_FULL_DIR}\zh-Hant\*.dll"
113+ SectionEnd
114+
115+ ; Component descriptions
116+ !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
117+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC_MAIN} " Notepad4 main program and matepath tool"
118+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC_LOCALE} " Multi-language support files"
119+ !insertmacro MUI_FUNCTION_DESCRIPTION_END
120+
38121Section " Uninstall"
39122 Delete " $INSTDIR\uninstall.exe"
40123 Delete " $INSTDIR\Notepad4.exe"
41124 Delete " $INSTDIR\matepath.exe"
42125
126+ ; Delete locale folders
127+ RMDir /r " $INSTDIR\locale"
128+
43129 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} " ${PRODUCT_UNINST_KEY}"
44130 DeleteRegKey HKLM " ${PRODUCT_DIR_REGKEY}"
45131
0 commit comments