1 ! Copyright (C) 2007, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: io io.encodings.binary io.files io.pathnames io.directories
4 io.encodings.ascii kernel namespaces
5 sequences locals system splitting tools.deploy.backend
6 tools.deploy.config tools.deploy.config.editor assocs hashtables
7 prettyprint combinators windows.kernel32 windows.shell32 windows.user32
8 alien.c-types vocabs.metadata vocabs.loader tools.deploy.windows.ico
10 IN: tools.deploy.windows
12 CONSTANT: app-icon-resource-id "APPICON"
14 :: copy-vm ( executable bundle-name extension -- vm )
15 vm "." split1-last drop extension append
16 bundle-name executable ".exe" append append-path
19 : create-exe-dir ( vocab bundle-name -- vm )
20 deploy-console? get ".com" ".exe" ? copy-vm ;
22 : open-in-explorer ( dir -- )
23 [ f "open" ] dip absolute-path normalize-separators
24 f f SW_SHOWNORMAL ShellExecute drop ;
26 : embed-ico ( vm vocab -- )
27 dup vocab-windows-icon-path vocab-append-path dup exists?
28 [ binary file-contents app-icon-resource-id embed-icon-resource ]
32 deploy-directory get [
36 [ create-exe-dir dup ]
38 [ drop deployed-image-name ]
39 [ drop namespace make-deploy-image-executable ]
40 [ nip "" [ copy-resources ] [ copy-libraries ] 3bi ]
41 [ nip open-in-explorer ]