Skip to content

Commit fec1079

Browse files
fix(windows): include patch version in RC FILEVERSION field
The Windows RC FILEVERSION requires all four numeric fields; omitting the patch component left it as an empty string, which breaks NSIS's `!getdllversion` macro used to derive the installer filename.
1 parent 77421cc commit fec1079

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎deploy/windows/version.rc.in‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
IDI_APP_ICON ICON "NotepadAI.ico"
44

55
VS_VERSION_INFO VERSIONINFO
6-
FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,0,0
7-
PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,0,0
6+
FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH_OR_ZERO@,0
7+
PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH_OR_ZERO@,0
88
FILEFLAGSMASK 0x3fL
99
FILEFLAGS 0x0L
1010
FILEOS 0x4L

‎src/CMakeLists.txt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,13 @@ target_include_directories(NotepadAI
266266
)
267267

268268
if(WIN32)
269+
# project() leaves PROJECT_VERSION_PATCH empty when VERSION has only major.minor;
270+
# the Windows RC FILEVERSION field requires a numeric value, and NSIS reads this
271+
# back via !getdllversion to derive the installer filename, so default to 0.
272+
set(PROJECT_VERSION_PATCH_OR_ZERO "${PROJECT_VERSION_PATCH}")
273+
if(NOT PROJECT_VERSION_PATCH_OR_ZERO)
274+
set(PROJECT_VERSION_PATCH_OR_ZERO 0)
275+
endif()
269276
configure_file(
270277
"${CMAKE_SOURCE_DIR}/deploy/windows/version.rc.in"
271278
"${CMAKE_BINARY_DIR}/version.rc"

0 commit comments

Comments
 (0)