making better error messages

This commit is contained in:
steve donovan 2011-06-21 18:39:38 +02:00
parent 3ca03ea818
commit 20498f3ad7
1 changed files with 7 additions and 2 deletions

View File

@ -431,6 +431,11 @@ if path.isdir(args.file) then
file_list:append(F) file_list:append(F)
end end
end end
if #F == 0 then
quit("this directory contained no source files")
end
for F in file_list:iter() do for F in file_list:iter() do
extract_modules(F) extract_modules(F)
end end
@ -448,7 +453,7 @@ elseif path.isfile(args.file) then
setup_package_base() setup_package_base()
local ext = path.extension(args.file) local ext = path.extension(args.file)
local ftype = file_types[ext] local ftype = file_types[ext]
if not ftype then quit "unsupported extension" end if not ftype then quit "unsupported file extension" end
F = read_file(args.file,ftype) F = read_file(args.file,ftype)
extract_modules(F) extract_modules(F)
else else
@ -600,7 +605,7 @@ function generate_output()
ldoc = ldoc, ldoc = ldoc,
module = ldoc.single and ldoc.modules[1] or nil module = ldoc.single and ldoc.modules[1] or nil
}) })
if not out then quit(err) end if not out then quit("template failed: "..err) end
check_directory(args.dir) check_directory(args.dir)