Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ local serpent = require('serpent')
local generator = require('generator')
-- local lfs = require("lfs")
local DIR_SEP = '/'
local IS_WINDOWS = package.config:sub(1, 1) == '\\'


local function getFileList(path)
local i, t, popen = 0, {}, io.popen
for filename in popen('dir "' .. path .. '" /b'):lines() do
local cmd = IS_WINDOWS
and ('dir "' .. path .. '" /b')
or ('ls -1 "' .. path .. '"')
for filename in popen(cmd):lines() do
i = i + 1
t[i] = path .. DIR_SEP .. filename
end
Expand Down
6 changes: 6 additions & 0 deletions parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ local function extractInfo(filename)
local inOverview = false
local f = io.open(filename, 'r')
if f == nil then return end
-- On Windows io.open fails on a directory, but on Unix it succeeds and only
-- f:lines() errors with "Is a directory". Detect that case and bail out.
if f:read(0) == nil then
f:close()
return
end
for l in f:lines() do
i = i + 1
if l:find("^> __Parent__") then
Expand Down