Fix and clean up Windows deployment

db4
U-SLAVA-DFB8FF805\Slava 2008-05-10 15:22:38 -05:00
parent d33b57506a
commit 4a9a1ba2b5
5 changed files with 36 additions and 17 deletions

View File

@ -66,6 +66,9 @@ strings accessors io.encodings.utf8 math ;
[ "awk" ] [ "/usr/libexec/awk///" file-name ] unit-test [ "awk" ] [ "/usr/libexec/awk///" file-name ] unit-test
[ "" ] [ "" file-name ] unit-test [ "" ] [ "" file-name ] unit-test
[ "freetype6.dll" ] [ "resource:freetype6.dll" file-name ] unit-test
[ "freetype6.dll" ] [ "resource:/freetype6.dll" file-name ] unit-test
[ ] [ [ ] [
{ "Hello world." } { "Hello world." }
"test-foo.txt" temp-file ascii set-file-lines "test-foo.txt" temp-file ascii set-file-lines

View File

@ -142,7 +142,9 @@ PRIVATE>
: file-name ( path -- string ) : file-name ( path -- string )
dup root-directory? [ dup root-directory? [
right-trim-separators right-trim-separators
dup last-path-separator [ 1+ tail ] [ drop ] if dup last-path-separator [ 1+ tail ] [
drop "resource:" ?head [ file-name ] when
] if
] unless ; ] unless ;
! File info ! File info

View File

@ -8,14 +8,14 @@ debugger io.streams.c io.files io.backend
quotations io.launcher words.private tools.deploy.config quotations io.launcher words.private tools.deploy.config
bootstrap.image io.encodings.utf8 accessors ; bootstrap.image io.encodings.utf8 accessors ;
IN: tools.deploy.backend IN: tools.deploy.backend
: copy-vm ( executable bundle-name extension -- vm ) : copy-vm ( executable bundle-name extension -- vm )
[ prepend-path ] dip append vm over copy-file ; [ prepend-path ] dip append vm over copy-file ;
: copy-fonts ( name dir -- ) : copy-fonts ( name dir -- )
append-path "fonts/" resource-path swap copy-tree-into ; append-path "resource:fonts/" swap copy-tree-into ;
: image-name ( vocab bundle-name -- str ) : image-name ( vocab bundle-name -- str )
prepend-path ".image" append ; prepend-path ".image" append ;
: (copy-lines) ( stream -- ) : (copy-lines) ( stream -- )

View File

@ -0,0 +1,7 @@
IN: tools.deploy.windows.tests
USING: tools.deploy.windows tools.test sequences ;
[ t ] [
"foo" "resource:temp/test-copy-files" create-exe-dir
".exe" tail?
] unit-test

View File

@ -2,12 +2,15 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: io io.files kernel namespaces sequences system USING: io io.files kernel namespaces sequences system
tools.deploy.backend tools.deploy.config assocs hashtables tools.deploy.backend tools.deploy.config assocs hashtables
prettyprint windows.shell32 windows.user32 ; prettyprint combinators windows.shell32 windows.user32 ;
IN: tools.deploy.windows IN: tools.deploy.windows
: copy-dlls ( bundle-name -- ) : copy-dlls ( bundle-name -- )
{ "resource:freetype6.dll" "resource:zlib1.dll" "resource:factor.dll" } {
swap copy-files-into ; "resource:freetype6.dll"
"resource:zlib1.dll"
"resource:factor.dll"
} swap copy-files-into ;
: create-exe-dir ( vocab bundle-name -- vm ) : create-exe-dir ( vocab bundle-name -- vm )
dup copy-dlls dup copy-dlls
@ -15,11 +18,15 @@ IN: tools.deploy.windows
".exe" copy-vm ; ".exe" copy-vm ;
M: winnt deploy* M: winnt deploy*
"." resource-path [ "resource:" [
dup deploy-config [ deploy-name over deploy-config at
[ deploy-name get create-exe-dir ] keep [
[ deploy-name get image-name ] keep {
[ namespace make-deploy-image ] keep [ create-exe-dir ]
open-in-explorer [ image-name ]
] bind [ drop ]
[ drop deploy-config ]
} 2cleave make-deploy-image
]
[ nip open-in-explorer ] 2bi
] with-directory ; ] with-directory ;