don't die if a command line arg file fails to load
parent
9440f385e5
commit
90308af195
|
@ -1,5 +1,4 @@
|
||||||
- make-pane: if no input, just return pane-output
|
- make-pane: if no input, just return pane-output
|
||||||
- friendlier .factor-rc load error handling
|
|
||||||
- intrinsic char-slot set-char-slot
|
- intrinsic char-slot set-char-slot
|
||||||
|
|
||||||
- default library names are not useful
|
- default library names are not useful
|
||||||
|
|
|
@ -4,13 +4,12 @@ IN: kernel
|
||||||
USING: errors hashtables io kernel-internals lists namespaces
|
USING: errors hashtables io kernel-internals lists namespaces
|
||||||
parser sequences strings ;
|
parser sequences strings ;
|
||||||
|
|
||||||
: ?run-file ( file -- )
|
|
||||||
dup exists? [ [ dup run-file ] try ] when drop ;
|
|
||||||
|
|
||||||
: run-user-init ( -- )
|
: run-user-init ( -- )
|
||||||
#! Run user init file if it exists
|
#! Run user init file if it exists
|
||||||
"user-init" get
|
"user-init" get [
|
||||||
[ "~" get "/.factor-rc" append ?run-file ] when ;
|
"~" get "/.factor-rc" append dup exists?
|
||||||
|
[ try-run-file ] [ drop ] if
|
||||||
|
] when ;
|
||||||
|
|
||||||
: set-path ( value seq -- )
|
: set-path ( value seq -- )
|
||||||
unswons over [ nest [ set-path ] bind ] [ nip set ] if ;
|
unswons over [ nest [ set-path ] bind ] [ nip set ] if ;
|
||||||
|
@ -48,4 +47,4 @@ parser sequences strings ;
|
||||||
os "win32" = "ui" "tty" ? "shell" set ;
|
os "win32" = "ui" "tty" ? "shell" set ;
|
||||||
|
|
||||||
: parse-command-line ( -- )
|
: parse-command-line ( -- )
|
||||||
cli-args [ cli-arg ] subset [ run-file ] each ;
|
cli-args [ cli-arg ] subset [ try-run-file ] each ;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2004, 2005 Slava Pestov.
|
! Copyright (C) 2004, 2005 Slava Pestov.
|
||||||
! See http://factor.sf.net/license.txt for BSD license.
|
! See http://factor.sf.net/license.txt for BSD license.
|
||||||
IN: parser
|
IN: parser
|
||||||
USING: io kernel lists math namespaces sequences words ;
|
USING: errors io kernel lists math namespaces sequences words ;
|
||||||
|
|
||||||
: file-vocabs ( -- )
|
: file-vocabs ( -- )
|
||||||
"scratchpad" "in" set
|
"scratchpad" "in" set
|
||||||
|
@ -23,6 +23,10 @@ USING: io kernel lists math namespaces sequences words ;
|
||||||
: run-file ( file -- )
|
: run-file ( file -- )
|
||||||
parse-file call ;
|
parse-file call ;
|
||||||
|
|
||||||
|
: try-run-file ( file -- )
|
||||||
|
#! Run a file and trap errors, printing them to stdio.
|
||||||
|
[ [ run-file ] keep ] try drop ;
|
||||||
|
|
||||||
: parse-resource ( path -- quot )
|
: parse-resource ( path -- quot )
|
||||||
#! Resources are loaded from the resource-path variable, or
|
#! Resources are loaded from the resource-path variable, or
|
||||||
#! the current directory if it is not set. Words defined in
|
#! the current directory if it is not set. Words defined in
|
||||||
|
|
Loading…
Reference in New Issue