retroforth/interface/library.retro
crc 279c4e9473 fix a spelling error
FossilOrigin-Name: 416f06de107daf9843567a9d6daa204d386c345143094a96d37066008a0d59c4
2024-01-06 22:57:29 +00:00

24 lines
615 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 ;
~~~