Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
19 lines (13 sloc) 550 Bytes
! Copyright (C) 2015 John Benediktsson
! See http://factorcode.org/license.txt for BSD license
USING: accessors command-line formatting io io.monitors
io.pathnames kernel namespaces sequences ;
IN: file-monitor
: file-monitor-loop ( monitor -- )
dup next-change [ changed>> ] [ path>> ] bi
"%u %s\n" printf flush file-monitor-loop ;
: file-monitor-main ( -- )
command-line get ?first current-directory get or
dup "Monitoring %s\n" printf flush
[ t [ file-monitor-loop ] with-monitor ] with-monitors ;
MAIN: file-monitor-main