5ed4511bb9
FossilOrigin-Name: 167b8770f5c07d3b6d7286f1af297c0e4c1c1b776900b361a194db12e46ac10c
24 lines
614 B
Forth
24 lines
614 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:_Libray_`%s`_was_not_found s:format s:put nl ] choose ;
|
|
~~~
|