tools.deploy.windows.ico: Throw an error if the .ico is a unsupported

format.
db4
Doug Coleman 2013-01-08 15:51:26 -08:00
parent d0d75cfa06
commit 8d0137e0fd
1 changed files with 11 additions and 1 deletions

View File

@ -53,12 +53,22 @@ STRUCT: group-directory-entry
header clone >c-ptr group-directory concat append
icon-bytes ; inline
ERROR: unsupported-ico-format bytes format ;
: check-ico-type ( bytes -- bytes )
dup "PNG" head? [
"PNG" unsupported-ico-format
] when
dup B{ 0 0 } head? [
"UNKNOWN" unsupported-ico-format
] unless ;
PRIVATE>
:: embed-icon-resource ( exe ico-bytes id -- )
exe normalize-path 1 BeginUpdateResource :> hUpdate
hUpdate [
ico-bytes ico-group-and-icons :> ( group icons )
ico-bytes check-ico-type ico-group-and-icons :> ( group icons )
hUpdate RT_GROUP_ICON id 0 group dup byte-length
UpdateResource drop