 : monitor-loop ( monitor -- )
     #! On OS X, monitors give us the full path, so we chop it
     #! off if its there.
-    [ next-change path>> path>vocab changed-vocab reset-cache ]
+    [ next-change path>> P path>vocab changed-vocab reset-cache ]
     [ monitor-loop ]
     bi ;
 

: path>vocab-name ( path -- vocab )
    dup ".factor" tail? [ parent-directory ] when ;

: chop-vocab-root ( path -- path' )
    "resource:" prepend-path normalize-path
    dup vocab-roots get
    [ normalize-path ] map
    [ head? ] with find nip
    ?head drop ;


USING: accessors assocs command-line concurrency.messaging
continuations init io.backend io.files io.monitors io.pathnames
kernel namespaces sequences sets splitting threads fry
tr vocabs vocabs.loader vocabs.refresh vocabs.cache
io.files.links ;
IN: vocabs.refresh.monitor

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