2 -- $Id: filesystem.lua,v 1.10 2005/03/27 07:21:08 cpressey Exp $
3 -- Test of dfuibe_lua's filesystem functionalities.
5 App = require "app"; App.init()
8 local booltab = { [false] = "NO", [true] = "YES" }
11 name = "FileSystem/MountPoints test program",
12 logfile = "filesystem.log"
15 files = FileSystem.dir("/etc")
17 local fullfile = "/etc/" .. files[file]
18 local string = fullfile .. "..." ..
19 " is file? " .. booltab[FileSystem.is_file(fullfile)] ..
20 " is dir? " .. booltab[FileSystem.is_dir(fullfile)] ..
21 " is program? " .. booltab[FileSystem.is_program(fullfile)] ..
22 " size=" .. tostring(FileSystem.size_of(fullfile))
27 print("basename of " .. path .. " is " .. FileSystem.basename(path))
28 print("dirname of " .. path .. " is " .. FileSystem.dirname(path))
30 local fh, fname = FileSystem.mkstemp("/tmp/tmp.XXXXXX")
33 print("Wrote hello! to " .. fname)
35 local fs_descs = MountPoints.enumerate()
37 for i, fs_desc in fs_descs do
39 "mountpoint=", fs_desc.mountpoint,
40 "device=", fs_desc.device,