87 for k, v in pairs({...}) do |
87 for k, v in pairs({...}) do |
88 _G[v]=lib[v] |
88 _G[v]=lib[v] |
89 end |
89 end |
90 end |
90 end |
91 |
91 |
|
92 function ensure_dir_of(name) |
|
93 local dn = path.dirname(name) |
|
94 if dn ~= "" and not lfs.attributes(dn) then |
|
95 ensure_dir_of(dn) |
|
96 print("Creating directory", dn) |
|
97 lfs.mkdir(dn) |
|
98 end |
|
99 end |
|
100 |
92 function io.openX(file, mode) |
101 function io.openX(file, mode) |
93 if mode=='w' then |
102 if mode=='w' then |
94 local dn = path.dirname(file) |
103 ensure_dir_of(file) |
95 if not lfs.attributes(dn) then |
|
96 print("Ensure directory", dn) |
|
97 lfs.mkdir(dn) |
|
98 end |
|
99 end |
104 end |
100 local f, err = io.open(file, mode) |
105 local f, err = io.open(file, mode) |
101 if not f then |
106 if not f then |
102 error(file..": "..err) |
107 error(file..": "..err) |
103 end |
108 end |