luadoc.logger:info(string.format("generating file `%s'", filename))
-- TODO: confirm file overwrite
- local f = lfs.open(filename, "w")
+ local f = posix.open(filename, "w")
assert(f, string.format("could not open `%s' for writing", filename))
for _, block in ipairs(file_doc.doc) do
local assert, getfenv, ipairs, loadstring, pairs, setfenv, tostring, tonumber, type = assert, getfenv, ipairs, loadstring, pairs, setfenv, tostring, tonumber, type
local io = require"io"
-local lfs = require "lfs"
+local posix = require "posix"
local lp = require "luadoc.lp"
local luadoc = require"luadoc"
local package = package
if (#doc.files > 0 or #doc.modules > 0) and (not options.noindexpage) then
local filename = options.output_dir.."index.html"
logger:info(string.format("generating file `%s'", filename))
- local f = lfs.open(filename, "w")
+ local f = posix.open(filename, "w")
assert(f, string.format("could not open `%s' for writing", filename))
io.output(f)
include("index.lp", { doc = doc })
local filename = out_module(modulename)
logger:info(string.format("generating file `%s'", filename))
- local f = lfs.open(filename, "w")
+ local f = posix.open(filename, "w")
assert(f, string.format("could not open `%s' for writing", filename))
io.output(f)
include("module.lp", { doc = doc, module_doc = module_doc })
local filename = out_file(file_doc.name)
logger:info(string.format("generating file `%s'", filename))
- local f = lfs.open(filename, "w")
+ local f = posix.open(filename, "w")
assert(f, string.format("could not open `%s' for writing", filename))
io.output(f)
include("file.lp", { doc = doc, file_doc = file_doc} )
end
-- copy extra files
- local f = lfs.open(options.output_dir.."luadoc.css", "w")
+ local f = posix.open(options.output_dir.."luadoc.css", "w")
io.output(f)
include("luadoc.css")
f:close()
local assert, pairs, tostring, type = assert, pairs, tostring, type
local io = require "io"
-local lfs = require "lfs"
+local posix = require "posix"
local luadoc = require "luadoc"
local util = require "luadoc.util"
local tags = require "luadoc.taglet.standard.tags"
-- @return table with documentation
function directory (path, doc)
- for f in lfs.dir(path) do
+ for f in posix.files(path) do
local fullpath = path .. "/" .. f
- local attr = lfs.attributes(fullpath)
+ local attr = posix.stat(fullpath)
assert(attr, string.format("error stating file `%s'", fullpath))
- if attr.mode == "file" then
+ if attr.type == "regular" then
doc = file(fullpath, doc)
- elseif attr.mode == "directory" and f ~= "." and f ~= ".." then
+ elseif attr.type == "directory" and f ~= "." and f ~= ".." then
doc = directory(fullpath, doc)
end
end
assert(doc.modules, "undefined `modules' field")
table.foreachi(files, function (_, path)
- local attr = lfs.attributes(path)
+ local attr = posix.stat(path)
assert(attr, string.format("error stating path `%s'", path))
- if attr.mode == "file" then
+ if attr.type == "regular" then
doc = file(path, doc)
- elseif attr.mode == "directory" then
+ elseif attr.type == "directory" then
doc = directory(path, doc)
end
end)
-- @release $Id: util.lua,v 1.16 2008/02/17 06:42:51 jasonsantos Exp $
-------------------------------------------------------------------------------
-local lfs = require "lfs"
+local posix = require "posix"
local type, table, string, io, assert, tostring, setmetatable, pcall = type, table, string, io, assert, tostring, setmetatable, pcall
-------------------------------------------------------------------------------
-- @param mode mode of opening
-- @return file handle
-function lfs.open (filename, mode)
+function posix.open (filename, mode)
local f = io.open(filename, mode)
if f == nil then
filename = string.gsub(filename, "\\", "/")
local dir = ""
for d in string.gfind(filename, ".-/") do
dir = dir .. d
- lfs.mkdir(dir)
+ posix.mkdir(dir)
end
f = io.open(filename, mode)
end