From 87cba772141ba3b220963ab62b9788f59399bbca Mon Sep 17 00:00:00 2001 From: jrtxio Date: Sat, 17 Oct 2026 20:32:27 +0800 Subject: [PATCH] Emit the app icon at resource ID 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit IDI_RIVET_APP_ICON compiled to a string-named resource: LoadIconW with MAKEINTRESOURCEW(1) — the app-icon slot hosts load for the tray and window — could never reach it. Numeric 1 is the conventional slot and deterministic; the resources test pins it. --- rivet-cli/build.rkt | 7 +++++-- rivet/tests/resources.rkt | 8 +++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/rivet-cli/build.rkt b/rivet-cli/build.rkt index 01fd1fb5..10a985d7 100644 --- a/rivet-cli/build.rkt +++ b/rivet-cli/build.rkt @@ -202,10 +202,13 @@ (when source ;; Resource Compiler treats backslashes as escapes inside quoted ;; paths. Forward slashes are accepted by Windows tools and keep - ;; arbitrary project directory names unambiguous. + ;; arbitrary project directory names unambiguous. The numeric ID 1 + ;; is the app-icon slot hosts address with LoadIconW(MAKEINTRESOURCEW(1)); + ;; a bare identifier would compile to a string-named resource no + ;; numeric lookup can reach. (define portable (string-replace (path->string source) "\\" "/")) - (fprintf out "IDI_RIVET_APP_ICON ICON \"~a\"\n" portable)) + (fprintf out "1 ICON \"~a\"\n" portable)) (write-windows-version-info! out project))) resource-script) diff --git a/rivet/tests/resources.rkt b/rivet/tests/resources.rkt index bc65b295..aadc0320 100644 --- a/rivet/tests/resources.rkt +++ b/rivet/tests/resources.rkt @@ -76,8 +76,10 @@ (define rc (prepare-windows-icon-resource! project)) (check-true (file-exists? rc)) (check-true - (regexp-match? #rx"IDI_RIVET_APP_ICON ICON" - (file->string rc))) + ;; Numeric ID 1: the app-icon slot, addressable with + ;; LoadIconW(MAKEINTRESOURCEW(1)). A bare identifier would compile to a + ;; string-named resource no numeric lookup can reach. + (regexp-match? #rx"^1 ICON " (file->string rc))) (check-false (regexp-match? #rx"\\\\" (file->string rc))) ;; The version block always ships, icon or not: identity in Explorer, ;; Task Manager, and installer UX is not optional for packaged apps. @@ -97,7 +99,7 @@ (parameterize ([current-error-port iconless-stderr]) (prepare-windows-icon-resource! (rivet-project temp-root #hasheq((name . "Demo_App")))))) (check-false - (regexp-match? #rx"IDI_RIVET_APP_ICON" (file->string iconless-rc))) + (regexp-match? #rx"1 ICON" (file->string iconless-rc))) (check-true (regexp-match? #rx"no `windows-icon`" (get-output-string iconless-stderr)))