-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.lua
More file actions
64 lines (48 loc) · 1.58 KB
/
demo.lua
File metadata and controls
64 lines (48 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
local X=require "luafpp"
print "luafpp:"
for k,v in pairs(X) do print("==", k, v) end
print("pwd", X.pwd())
X.cd "LuaAide" print("pwd", X.pwd())
X.cd ".." print("pwd", X.pwd())
local D=X.subdirs "."
for j,k in ipairs(D) do print("==",j,k) end
X.mkdir "neuesdir"
print "mkdir neuesdir: walkdir .:"
local A=X.walkdir "."
for k,v in ipairs(A) do
local s=string.format("%s %s == %s", v.type, v.name, v.abspath)
print("==", k, s)
end
X.rmdir "neuesdir"
print "remove neuesdir: walkdir .:"
local A=X.walkdir "."
for k,v in ipairs(A) do
local s=string.format("%s %s == %s", v.type, v.name, v.abspath)
print("==", k, s)
end
local f,err=X.touch "nixda.txt"
if not f then
-- io.output "nixda.txt" :write "nixda"
-- io.close()
print("Cannot touch nixda.txt:", err)
end
print "=========="
for k,v in ipairs(A) do
local s=string.format("%s %3d user group %8d %s %s %s", X.permissions(v.abspath), X.numlinks(v.abspath), X.filesize(v.abspath), X.type(v.abspath), v.type, v.name)
print(s)
end
print "========== absolute"
print("Makefile, absolute:", X.absolute "Makefile")
print "========== canonical"
local a="buildsys/..\\Makefile99"
print(a..", canonical:", X.canonical(a))
print "========== weakly_canonical"
local a="buildsys/..\\Makefile99"
print(a..", weakly_canonical:", X.weakly_canonical(a))
print "========== relative"
local a=X.absolute "../master/src/main.cpp"
print(a..", relative:", X.relative(a))
print "========== relative base"
local a=X.absolute "../master/src/main.cpp"
local b=X.absolute "../master/buildsys"
print(a..", relative:", X.relative(a, b))