2009-01-28 02:57:46 -05:00
|
|
|
! Copyright (C) 2007, 2009 Slava Pestov.
|
2007-11-05 00:45:02 -05:00
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2016-08-21 20:05:32 -04:00
|
|
|
USING: combinators io.backend io.directories io.encodings.binary
|
|
|
|
io.files io.pathnames kernel locals namespaces sequences splitting
|
|
|
|
system tools.deploy.backend tools.deploy.config
|
|
|
|
tools.deploy.config.editor tools.deploy.windows.ico vocabs.loader
|
|
|
|
webbrowser ;
|
2007-11-05 00:45:02 -05:00
|
|
|
IN: tools.deploy.windows
|
|
|
|
|
2010-02-15 14:49:03 -05:00
|
|
|
CONSTANT: app-icon-resource-id "APPICON"
|
|
|
|
|
2015-07-20 03:03:00 -04:00
|
|
|
:: copy-vm ( executable bundle-name extension -- vm-path )
|
|
|
|
vm-path "." split1-last drop extension append
|
2009-01-28 02:57:46 -05:00
|
|
|
bundle-name executable ".exe" append append-path
|
2016-03-30 02:46:34 -04:00
|
|
|
[ copy-file ] keep normalize-path ;
|
2009-01-28 02:57:46 -05:00
|
|
|
|
2015-07-20 03:03:00 -04:00
|
|
|
: create-exe-dir ( vocab bundle-name -- vm-path )
|
2010-03-23 18:32:16 -04:00
|
|
|
deploy-console? get ".com" ".exe" ? copy-vm ;
|
2007-11-05 00:45:02 -05:00
|
|
|
|
2016-03-23 10:44:35 -04:00
|
|
|
: vocab-windows-icon-path ( vocab -- string )
|
|
|
|
vocab-dir "icon.ico" append-path ;
|
|
|
|
|
2015-07-20 03:03:00 -04:00
|
|
|
: embed-ico ( vm-path vocab -- )
|
2010-02-15 14:49:03 -05:00
|
|
|
dup vocab-windows-icon-path vocab-append-path dup exists?
|
2010-02-15 17:04:11 -05:00
|
|
|
[ binary file-contents app-icon-resource-id embed-icon-resource ]
|
2010-02-15 14:49:03 -05:00
|
|
|
[ 2drop ] if ;
|
|
|
|
|
2011-09-18 21:25:06 -04:00
|
|
|
M: windows deploy*
|
2016-08-20 23:29:24 -04:00
|
|
|
deploy-name get
|
|
|
|
{
|
|
|
|
[ create-exe-dir dup ]
|
|
|
|
[ drop embed-ico ]
|
|
|
|
[ drop deployed-image-name ]
|
|
|
|
[ drop namespace make-deploy-image-executable ]
|
2016-08-21 00:13:45 -04:00
|
|
|
[ nip "" [ copy-resources ] [ copy-libraries ] 3bi ]
|
2016-12-17 22:12:56 -05:00
|
|
|
[ nip maybe-open-deploy-directory ]
|
2016-08-20 23:29:24 -04:00
|
|
|
} 2cleave ;
|
2015-08-04 22:06:19 -04:00
|
|
|
|
|
|
|
M: windows deploy-path
|
|
|
|
deploy-directory get [
|
|
|
|
dup deploy-config [
|
|
|
|
deploy-name get
|
|
|
|
swap ".exe" append append-path
|
|
|
|
normalize-path
|
|
|
|
] with-variables
|
|
|
|
] with-directory ;
|