summaryrefslogtreecommitdiff
path: root/tests/modules/fwatcher/watchdirs.lua
blob: 9d3b81add6c45272814404e764b2c73962859b2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import("core.base.fwatcher")

function main(watchdir)
    print("watch %s ..", watchdir)
    fwatcher.watchdirs(watchdir, function (event)
        local status
        if event.type == fwatcher.ET_CREATE then
            status = "created"
        elseif event.type == fwatcher.ET_MODIFY then
            status = "modified"
        elseif event.type == fwatcher.ET_DELETE then
            status = "deleted"
        end
        print(event.path, status)
    end)
end