diff options
-rw-r--r-- | libs/uvl/luasrc/uvl/datatypes.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libs/uvl/luasrc/uvl/datatypes.lua b/libs/uvl/luasrc/uvl/datatypes.lua index fc37fa3c69..615e2946d4 100644 --- a/libs/uvl/luasrc/uvl/datatypes.lua +++ b/libs/uvl/luasrc/uvl/datatypes.lua @@ -169,3 +169,19 @@ function file( val, seen ) return false end + +function device( val, seen ) + local s = fs.stat( val ) + seen = seen or { } + + if s and not seen[s.ino] then + seen[s.ino] = true + if s.type == "character device" or s.type == "block device" then + return true + elseif s.type == "link" then + return device( fs.readlink(val), seen ) + end + end + + return false +end |