Skip to content

Commit

Permalink
vocabs.refresh.monitor: only check valid vocab names
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed May 27, 2024
1 parent 4cc6940 commit b5b5922
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions basis/vocabs/refresh/monitor/monitor.factor
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
USING: accessors command-line continuations fry init io
io.backend io.files io.monitors io.pathnames kernel namespaces
prettyprint sequences splitting threads tr vocabs vocabs.cache
vocabs.loader vocabs.refresh ;
vocabs.loader vocabs.private vocabs.refresh ;
IN: vocabs.refresh.monitor

TR: convert-separators "/\\" ".." ;

: vocab-dir>vocab-name ( path -- vocab )
: vocab-dir>vocab-name ( path -- vocab/f )
trim-head-separators
trim-tail-separators
convert-separators ;
convert-separators
dup valid-vocab-name? [ drop f ] unless ;

: path>vocab-parent-dir ( path -- path' )
dup ".factor" tail? [ parent-directory ] when ;
Expand All @@ -24,7 +25,7 @@ TR: convert-separators "/\\" ".." ;
[ head? ] with find nip
?head drop ;

: path>vocab-name ( path -- vocab-name )
: path>vocab-name ( path -- vocab-name/f )
chop-vocab-root path>vocab-parent-dir vocab-dir>vocab-name ;

: monitor-loop ( monitor -- )
Expand All @@ -33,8 +34,9 @@ TR: convert-separators "/\\" ".." ;
[
next-change path>>
[
path>vocab-name
[ changed-vocab ] [ reset-cache ] bi
path>vocab-name [
[ changed-vocab ] [ reset-cache ] bi
] when*
] [
[
[ "monitor-loop warning for path ``" "``:" surround write ]
Expand Down

0 comments on commit b5b5922

Please sign in to comment.