Sun, 06 Sep 2020 22:12:52 +0300
Don't auto-create directories that will be empty
handlers/copy.lua | file | annotate | diff | comparison | revisions | |
lgen.lua | file | annotate | diff | comparison | revisions | |
luaext.lua | file | annotate | diff | comparison | revisions | |
mypath.lua | file | annotate | diff | comparison | revisions | |
tuple.lua | file | annotate | diff | comparison | revisions |
--- a/handlers/copy.lua Sun Sep 06 21:24:39 2020 +0300 +++ b/handlers/copy.lua Sun Sep 06 22:12:52 2020 +0300 @@ -2,6 +2,7 @@ --@module handlers.copy local path=require("mypath") +local lfs=require("lfs") local handlers_copy={}
--- a/lgen.lua Sun Sep 06 21:24:39 2020 +0300 +++ b/lgen.lua Sun Sep 06 22:12:52 2020 +0300 @@ -56,7 +56,7 @@ scan.map(hierarchy, function(f) handlers.phase2(f, env) end, function(d) --log.log("Make path "..path.join(dst, d).."\n") - lfs.mkdir(path.join(dst, d)) + --lfs.mkdir(path.join(dst, d)) end) --print('Phase 3...') --scan.map(hierarchy, function(f) handlers.phase3(f, env) end)
--- a/luaext.lua Sun Sep 06 21:24:39 2020 +0300 +++ b/luaext.lua Sun Sep 06 22:12:52 2020 +0300 @@ -6,6 +6,8 @@ -- See the included file LICENSE for details. -- +local lfs=require("lfs") +local path=require("mypath") --DOC -- Make \var{str} shell-safe. @@ -87,8 +89,15 @@ end end -function io.openX(file, ...) - local f, err = io.open(file, ...) +function io.openX(file, mode) + if mode=='w' then + local dn = path.dirname(file) + if not lfs.attributes(dn) then + print("Ensure directory", dn) + lfs.mkdir(dn) + end + end + local f, err = io.open(file, mode) if not f then error(file..": "..err) end