io.files: check argv when initing resource-path

db4
Joe Groff 2012-03-27 16:58:12 -07:00
parent 64a746be73
commit 83a3a0346b
2 changed files with 10 additions and 8 deletions

View File

@ -3,8 +3,7 @@
USING: arrays assocs continuations debugger generic hashtables USING: arrays assocs continuations debugger generic hashtables
init io io.files kernel kernel.private make math memory init io io.files kernel kernel.private make math memory
namespaces parser parser.notes prettyprint sequences splitting namespaces parser parser.notes prettyprint sequences splitting
system vectors vocabs vocabs.loader words destructors system vectors vocabs vocabs.loader words destructors ;
io.encodings.utf8 alien.strings ;
QUALIFIED: bootstrap.image.private QUALIFIED: bootstrap.image.private
IN: bootstrap.stage1 IN: bootstrap.stage1
@ -38,9 +37,7 @@ load-help? off
[ [
f parser-quiet? set-global f parser-quiet? set-global
OBJ-ARGS special-object init-resource-path
[ utf8 alien>string "-resource-path=" ?head [ drop f ] unless ] map-find drop
[ "resource-path" set-global ] when*
"resource:basis/bootstrap/stage2.factor" "resource:basis/bootstrap/stage2.factor"
dup exists? [ dup exists? [

View File

@ -1,8 +1,8 @@
! Copyright (C) 2004, 2009 Slava Pestov, Daniel Ehrenberg. ! Copyright (C) 2004, 2009 Slava Pestov, Daniel Ehrenberg.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel kernel.private sequences init namespaces system io USING: kernel kernel.private sequences init namespaces system io
io.backend io.pathnames io.encodings io.files.private io.encodings.utf8 io.backend io.pathnames io.encodings io.files.private
alien.strings ; alien.strings splitting ;
IN: io.files IN: io.files
MIXIN: file-reader MIXIN: file-reader
@ -61,9 +61,14 @@ M: object cwd ( -- path ) "." ;
PRIVATE> PRIVATE>
: init-resource-path ( -- )
OBJ-ARGS special-object
[ utf8 alien>string "-resource-path=" ?head [ drop f ] unless ] map-find drop
[ image parent-directory ] unless* "resource-path" set-global ;
[ [
cwd current-directory set-global cwd current-directory set-global
OBJ-IMAGE special-object alien>native-string cwd prepend-path \ image 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 set-global
image parent-directory "resource-path" set-global init-resource-path
] "io.files" add-startup-hook ] "io.files" add-startup-hook