-- provides a drop-in replacement of xgettext that supports Lua (but not any
-- other language)
+local util = require("util")
local cutil = require("cutil")
local getopt = require("getopt")
if not excluded_files[fname] then
if onlylua or (not neverlua and fname:lower():match("^.+%.lua$")) then
-- parse lua files here
+ local fpath = util.find_file(fname, search_dirs)
else
args_nolua[#args_nolua] = fname
local f = assert(cutil.popenv(hasxgettext, "r",
return ret
end
+-- file utils
+
+M.find_file = function(fname, paths)
+ for i, path in ipairs(paths) do
+ local actual_path
+ if path:match(".*/") then
+ actual_path = path .. fname
+ else
+ actual_path = path .. "/" .. fname
+ end
+ local f = io.open(actual_path)
+ if f then
+ f:close()
+ return actual_path
+ end
+ end
+end
+
return M
\ No newline at end of file