09ac843c9e
FossilOrigin-Name: 746d00862c208a73ef9ca13afc34c49834d24ac068582693341cd01a54687475
35 lines
907 B
Forth
35 lines
907 B
Forth
~~~
|
|
'HOME d:create #1025 allot
|
|
|
|
'%s/.config/retroforth/library/%s.retro 'library:.CONFIG s:const
|
|
'./library/%s.retro 'library:CWD s:const
|
|
|
|
:library:cwd library:CWD s:format ;
|
|
|
|
:library:.config
|
|
'HOME &HOME unix:getenv
|
|
&HOME library:.CONFIG s:format ;
|
|
|
|
:library:filename (s-s)
|
|
dup library:cwd
|
|
dup file:exists? [ nip ] if; drop
|
|
library:.config dup file:exists? [ ] if; drop s:empty ;
|
|
|
|
:library:contains? (s-f)
|
|
&library:cwd &library:.config bi &file:exists? bi@ or ;
|
|
|
|
:library:load
|
|
dup library:contains? [ library:filename include ]
|
|
[ 'ERROR:_Library_`%s`_was_not_found s:format s:put nl ] choose ;
|
|
|
|
'interface/library.retro s:dedup
|
|
dup 'library:load d:set-source
|
|
dup 'library:contains? d:set-source
|
|
dup 'library:filename d:set-source
|
|
dup 'library:.config d:set-source
|
|
dup 'library:cwd d:set-source
|
|
dup 'library:CWD d:set-source
|
|
dup 'library:.CONFIG d:set-source
|
|
dup 'HOME d:set-source
|
|
drop
|
|
~~~
|