Change how resource-path works
parent
7786c11eb2
commit
0568d50415
|
|
@ -63,9 +63,6 @@ xref-articles
|
||||||
0 exit
|
0 exit
|
||||||
] set-boot
|
] set-boot
|
||||||
|
|
||||||
"Setting the resource path..." print
|
|
||||||
cwd "resource-path" set-global
|
|
||||||
|
|
||||||
[ compiled? ] word-subset length
|
[ compiled? ] word-subset length
|
||||||
number>string write " compiled words" print
|
number>string write " compiled words" print
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,26 @@ sequences-internals strings vectors words ;
|
||||||
|
|
||||||
M: object like drop ;
|
M: object like drop ;
|
||||||
|
|
||||||
: index ( obj seq -- n ) [ = ] find-with drop ; flushable
|
: index ( obj seq -- n )
|
||||||
: index* ( obj i seq -- n ) [ = ] find-with* drop ; flushable
|
[ = ] find-with drop ; flushable
|
||||||
: member? ( obj seq -- ? ) [ = ] contains-with? ; flushable
|
|
||||||
: memq? ( obj seq -- ? ) [ eq? ] contains-with? ; flushable
|
: index* ( obj i seq -- n )
|
||||||
: remove ( obj list -- list ) [ = not ] subset-with ; flushable
|
[ = ] find-with* drop ; flushable
|
||||||
|
|
||||||
|
: last-index ( obj seq -- n )
|
||||||
|
[ = ] find-last-with drop ; flushable
|
||||||
|
|
||||||
|
: last-index* ( obj i seq -- n )
|
||||||
|
[ = ] find-last-with* drop ; flushable
|
||||||
|
|
||||||
|
: member? ( obj seq -- ? )
|
||||||
|
[ = ] contains-with? ; flushable
|
||||||
|
|
||||||
|
: memq? ( obj seq -- ? )
|
||||||
|
[ eq? ] contains-with? ; flushable
|
||||||
|
|
||||||
|
: remove ( obj list -- list )
|
||||||
|
[ = not ] subset-with ; flushable
|
||||||
|
|
||||||
: (subst) ( newseq oldseq elt -- new/elt )
|
: (subst) ( newseq oldseq elt -- new/elt )
|
||||||
[ swap index ] keep
|
[ swap index ] keep
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
! 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: io
|
IN: io
|
||||||
USING: hashtables kernel lists math namespaces sequences strings
|
USING: hashtables kernel lists math memory namespaces sequences
|
||||||
styles ;
|
strings styles ;
|
||||||
|
|
||||||
! Words for accessing filesystem meta-data.
|
! Words for accessing filesystem meta-data.
|
||||||
|
|
||||||
|
|
@ -19,8 +19,12 @@ styles ;
|
||||||
|
|
||||||
: file-length ( file -- length ) stat third ;
|
: file-length ( file -- length ) stat third ;
|
||||||
|
|
||||||
|
: parent-dir ( path -- path )
|
||||||
|
CHAR: / over last-index CHAR: \\ pick last-index max
|
||||||
|
dup -1 = [ 2drop "." ] [ swap head ] if ;
|
||||||
|
|
||||||
: resource-path ( path -- path )
|
: resource-path ( path -- path )
|
||||||
"resource-path" get [ "." ] unless* swap path+ ;
|
image parent-dir swap path+ ;
|
||||||
|
|
||||||
: <resource-stream> ( path -- stream )
|
: <resource-stream> ( path -- stream )
|
||||||
#! Open a file path relative to the Factor source code root.
|
#! Open a file path relative to the Factor source code root.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue