Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions rivet-cli/build.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
8 changes: 5 additions & 3 deletions rivet/tests/resources.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)))

Expand Down
Loading