1 ! Copyright (C) 2007, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: combinators io.backend io.directories io.encodings.binary
4 io.files io.pathnames kernel locals namespaces sequences splitting
5 system tools.deploy.backend tools.deploy.config
6 tools.deploy.config.editor tools.deploy.windows.ico vocabs.loader
8 IN: tools.deploy.windows
10 CONSTANT: app-icon-resource-id "APPICON"
12 :: copy-vm ( executable bundle-name extension -- vm-path )
13 vm-path "." split1-last drop extension append
14 bundle-name executable ".exe" append append-path
15 [ copy-file ] keep normalize-path ;
17 : create-exe-dir ( vocab bundle-name -- vm-path )
18 deploy-console? get ".com" ".exe" ? copy-vm ;
20 : vocab-windows-icon-path ( vocab -- string )
21 vocab-dir "icon.ico" append-path ;
23 : embed-ico ( vm-path vocab -- )
24 dup vocab-windows-icon-path vocab-append-path dup exists?
25 [ binary file-contents app-icon-resource-id embed-icon-resource ]
31 [ create-exe-dir dup ]
33 [ drop deployed-image-name ]
34 [ drop namespace make-deploy-image-executable ]
35 [ nip "" [ copy-resources ] [ copy-libraries ] 3bi ]
36 [ nip maybe-open-deploy-directory ]
39 M: windows deploy-path
40 deploy-directory get [
43 swap ".exe" append append-path