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.
|
2015-08-05 10:26:01 -04:00
|
|
|
USING: combinators io.backend io.directories
|
|
|
|
io.encodings.binary io.files io.files.windows io.pathnames
|
|
|
|
kernel locals namespaces splitting sequences system
|
|
|
|
tools.deploy.backend tools.deploy.config
|
2015-07-19 20:37:51 -04:00
|
|
|
tools.deploy.config.editor tools.deploy.windows.ico
|
|
|
|
vocabs.loader vocabs.metadata windows.shell32 windows.user32 ;
|
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
|
|
|
|
[ copy-file ] keep ;
|
|
|
|
|
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
|
|
|
|
2010-02-17 17:42:53 -05:00
|
|
|
: open-in-explorer ( dir -- )
|
|
|
|
[ f "open" ] dip absolute-path normalize-separators
|
|
|
|
f f SW_SHOWNORMAL ShellExecute drop ;
|
|
|
|
|
2015-08-05 14:01:56 -04:00
|
|
|
: ?open-in-explorer ( dir -- )
|
|
|
|
open-directory-after-deploy? get [ open-in-explorer ] [ drop ] if ;
|
|
|
|
|
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*
|
2014-04-22 17:08:40 -04:00
|
|
|
deploy-directory get [
|
2008-11-09 18:27:51 -05:00
|
|
|
dup deploy-config [
|
|
|
|
deploy-name get
|
2010-02-15 02:10:05 -05:00
|
|
|
{
|
2010-02-15 14:49:03 -05:00
|
|
|
[ create-exe-dir dup ]
|
|
|
|
[ drop embed-ico ]
|
2011-11-21 14:44:27 -05:00
|
|
|
[ drop deployed-image-name ]
|
|
|
|
[ drop namespace make-deploy-image-executable ]
|
2010-02-16 16:32:14 -05:00
|
|
|
[ nip "" [ copy-resources ] [ copy-libraries ] 3bi ]
|
2015-08-05 14:01:56 -04:00
|
|
|
[ nip ?open-in-explorer ]
|
2015-06-29 19:43:15 -04:00
|
|
|
} 2cleave
|
2012-07-19 03:02:47 -04:00
|
|
|
] with-variables
|
2014-04-22 17:08:40 -04:00
|
|
|
] with-directory ;
|
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 ;
|