] when ;
: default-image-name ( -- string )
- vm file-name os windows? [ "." split1-last drop ] when
+ vm-path file-name os windows? [ "." split1-last drop ] when
".image" append resource-path ;
: load-components ( -- )
"Bootstrapping is complete." print
"Now, you can run Factor:" print
- vm write " -i=" write "output-image" get print flush ;
+ vm-path write " -i=" write "output-image" get print flush ;
: save/restore-error ( quot -- )
error get-global
: cli-usage ( -- )
"""
-Usage: """ write vm file-name write """ [Factor arguments] [script] [script arguments]
+Usage: """ write vm-path file-name write """ [Factor arguments] [script] [script arguments]
Common arguments:
-help print this message and exit
- -i=<image> load Factor image file <image> (default """ write vm file-stem write """.image)
+ -i=<image> load Factor image file <image> (default """ write vm-path file-stem write """.image)
-run=<vocab> run the MAIN: entry point of <vocab>
-run=listener run terminal listener
-run=ui.tools run Factor development UI
: run-vm-with-script ( -- lines )
<process>
- [ vm , callback-error-script , ] { } make >>command
+ [ vm-path , callback-error-script , ] { } make >>command
+closed+ >>stdin
+stdout+ >>stderr
ascii <process-reader> stream-lines ;
! closing stdin caused some problems
{ } [
[
- vm ,
+ vm-path ,
"-i=" image append ,
"-run=none" ,
"-e=USING: destructors namespaces io calendar threads ; input-stream get dispose 1 seconds sleep" ,
USING: tools.test io.files.info.windows system kernel ;
IN: io.files.info.windows.tests
-[ ] [ vm file-times 3drop ] unit-test
+[ ] [ vm-path file-times 3drop ] unit-test
try-output-process
] must-fail
-: console-vm ( -- path )
- vm ".exe" ?tail [ ".com" append ] when ;
+: console-vm-path ( -- path )
+ vm-path ".exe" ?tail [ ".com" append ] when ;
SYMBOLS: out-path err-path ;
[ ] [
<process>
- console-vm "-run=hello-world" 2array >>command
+ console-vm-path "-run=hello-world" 2array >>command
"out.txt" unique-file [ out-path set-global ] keep >>stdout
try-process
] unit-test
[ "IN: scratchpad " ] [
<process>
- console-vm "-run=listener" 2array >>command
+ console-vm-path "-run=listener" 2array >>command
+closed+ >>stdin
+stdout+ >>stderr
utf8 [ lines last ] with-process-reader
[ ] [
launcher-test-path [
<process>
- console-vm "-script" "stderr.factor" 3array >>command
+ console-vm-path "-script" "stderr.factor" 3array >>command
"out.txt" unique-file [ out-path set-global ] keep >>stdout
"err.txt" unique-file [ err-path set-global ] keep >>stderr
try-process
[ ] [
launcher-test-path [
<process>
- console-vm "-script" "stderr.factor" 3array >>command
+ console-vm-path "-script" "stderr.factor" 3array >>command
"out.txt" unique-file [ out-path set-global ] keep >>stdout
+stdout+ >>stderr
try-process
[ "output" ] [
launcher-test-path [
<process>
- console-vm "-script" "stderr.factor" 3array >>command
+ console-vm-path "-script" "stderr.factor" 3array >>command
"err2.txt" unique-file [ err-path set-global ] keep >>stderr
utf8 <process-reader> stream-lines first
] with-directory
[ t ] [
launcher-test-path [
<process>
- console-vm "-script" "env.factor" 3array >>command
+ console-vm-path "-script" "env.factor" 3array >>command
utf8 [ contents ] with-process-reader
] with-directory eval( -- alist )
[ t ] [
launcher-test-path [
<process>
- console-vm "-script" "env.factor" 3array >>command
+ console-vm-path "-script" "env.factor" 3array >>command
+replace-environment+ >>environment-mode
os-envs >>environment
utf8 [ contents ] with-process-reader
[ "B" ] [
launcher-test-path [
<process>
- console-vm "-script" "env.factor" 3array >>command
+ console-vm-path "-script" "env.factor" 3array >>command
{ { "A" "B" } } >>environment
utf8 [ contents ] with-process-reader
] with-directory eval( -- alist )
[ f ] [
launcher-test-path [
<process>
- console-vm "-script" "env.factor" 3array >>command
+ console-vm-path "-script" "env.factor" 3array >>command
{ { "USERPROFILE" "XXX" } } >>environment
+prepend-environment+ >>environment-mode
utf8 [ contents ] with-process-reader
2 [
launcher-test-path [
<process>
- console-vm "-script" "append.factor" 3array >>command
+ console-vm-path "-script" "append.factor" 3array >>command
out-path get-global <appender> >>stdout
try-process
] with-directory
] unit-test
[ "IN: scratchpad " ] [
- console-vm "-run=listener" 2array
+ console-vm-path "-run=listener" 2array
ascii [ "USE: system 0 exit" print flush lines last ] with-process-stream
] unit-test
[ ] [
- console-vm "-run=listener" 2array
+ console-vm-path "-run=listener" 2array
ascii [ "USE: system 0 exit" print ] with-process-writer
] unit-test
[ ] [
<process>
- console-vm "-run=listener" 2array >>command
+ console-vm-path "-run=listener" 2array >>command
"vocab:io/launcher/windows/test/input.txt" >>stdin
try-process
] unit-test
tools.deploy.embed locals ;
IN: tools.deploy.backend
-: copy-vm ( executable bundle-name -- vm )
- prepend-path vm over copy-file ;
+: copy-vm ( executable bundle-name -- vm-path )
+ prepend-path vm-path over copy-file ;
TUPLE: vocab-manifest vocabs libraries ;
] bi
] { } make ;
-: run-factor ( vm flags -- )
+: run-factor ( vm-path flags -- )
swap prefix dup . run-with-output ; inline
DEFER: ?make-staging-image
: make-staging-image ( profile -- )
dup [ but-last ?make-staging-image ] unless-empty
- vm swap staging-command-line run-factor ;
+ vm-path swap staging-command-line run-factor ;
: ?make-staging-image ( profile -- )
dup staging-image-name exists?
[ "invalid vocab manifest!" throw ] if
] if-empty ;
-:: make-deploy-image ( vm image vocab config -- manifest )
+:: make-deploy-image ( vm-path image vocab config -- manifest )
make-boot-image
config [
bootstrap-profile :> profile
vocab "vocab-manifest-" prepend temp-file :> manifest-file
image vocab manifest-file profile deploy-command-line :> flags
profile ?make-staging-image
- vm flags run-factor
+ vm-path flags run-factor
manifest-file parse-vocab-manifest-file
] with-variables ;
-:: make-deploy-image-executable ( vm image vocab config -- manifest )
- vm image vocab config make-deploy-image
- image vm embed-image ;
+:: make-deploy-image-executable ( vm-path image vocab config -- manifest )
+ vm-path image vocab config make-deploy-image
+ image vm-path embed-image ;
HOOK: deploy* os ( vocab -- )
dup find-vocab-root [ check-vocab-main deploy* ] [ no-vocab ] if ;
: deploy-image-only ( vocab image -- )
- [ vm ] 2dip
+ [ vm-path ] 2dip
swap dup deploy-config make-deploy-image drop ;
{
swap [ copy-file ] keep embed-image ;
: make-embedded-image ( from-image to-executable -- )
- vm swap make-embedded-image* ;
+ vm-path swap make-embedded-image* ;
: bundle-dir ( -- dir )
running.app?
- [ vm parent-directory parent-directory parent-directory ]
+ [ vm-path parent-directory parent-directory parent-directory ]
[ "resource:Factor.app" ]
if ;
input-stream
output-stream
error-stream
- vm
+ vm-path
image
current-directory
} %
: shake-and-bake ( vocab -- )
[ test-image temp-file delete-file ] ignore-errors
[
- [ vm test-image temp-file ] dip
+ [ vm-path test-image temp-file ] dip
dup deploy-config make-deploy-image drop
] with-resource-directory ;
: deploy-test-command ( -- args )
os macosx?
- "resource:Factor.app/Contents/MacOS/factor" normalize-path vm ?
+ "resource:Factor.app/Contents/MacOS/factor" normalize-path vm-path ?
"-i=" test-image temp-file append 2array ;
: run-temp-image ( -- )
CONSTANT: app-icon-resource-id "APPICON"
-:: copy-vm ( executable bundle-name extension -- vm )
- vm "." split1-last drop extension append
+:: copy-vm ( executable bundle-name extension -- vm-path )
+ vm-path "." split1-last drop extension append
bundle-name executable ".exe" append append-path
[ copy-file ] keep ;
-: create-exe-dir ( vocab bundle-name -- vm )
+: create-exe-dir ( vocab bundle-name -- vm-path )
deploy-console? get ".com" ".exe" ? copy-vm ;
: open-in-explorer ( dir -- )
[ f "open" ] dip absolute-path normalize-separators
f f SW_SHOWNORMAL ShellExecute drop ;
-: embed-ico ( vm vocab -- )
+: embed-ico ( vm-path vocab -- )
dup vocab-windows-icon-path vocab-append-path dup exists?
[ binary file-contents app-icon-resource-id embed-icon-resource ]
[ 2drop ] if ;
[
cwd current-directory set-global
OBJ-IMAGE special-object alien>native-string cwd prepend-path \ image set-global
- OBJ-EXECUTABLE special-object alien>native-string cwd prepend-path \ vm set-global
+ OBJ-EXECUTABLE special-object alien>native-string cwd prepend-path \ vm-path set-global
init-resource-path
] "io.files" add-startup-hook
}
"Getting the path to the Factor VM and image:"
{ $subsections
- vm
+ vm-path
image
}
"Getting a monotonically increasing nanosecond count:"
{ $values { "path" "a pathname string" } }
{ $description "Outputs the pathname of the currently running Factor image." } ;
-HELP: vm
+HELP: vm-path
{ $values { "path" "a pathname string" } }
{ $description "Outputs the pathname of the currently running Factor VM." } ;
: image ( -- path ) \ image get-global ;
-: vm ( -- path ) \ vm get-global ;
+: vm-path ( -- path ) \ vm-path get-global ;
: embedded? ( -- ? ) OBJ-EMBEDDED special-object ;
FUNCTION: void* start_standalone_factor_in_new_thread ( int argc, c-string* argv )
: start-vm-in-os-thread ( args -- threadhandle )
- vm prefix
+ vm-path prefix
[ length ] [ native-string-encoding strings>alien ] bi
start_standalone_factor_in_new_thread ;