Current section
Files
Jump to
Current section
Files
lib/ex_catalog/util.ex
defmodule ExCatalog.Util do
def module_compiled?(module) do
function_exported?(module, :__info__, 1)
end
def list_all(filepath) do
_list_all(filepath)
end
defp _list_all(filepath) do
cond do
String.contains?(filepath, ".git") -> []
true -> expand(File.ls(filepath), filepath)
end
end
defp expand({:ok, files}, path) do
files
|> Enum.flat_map(&_list_all("#{path}/#{&1}"))
end
defp expand({:error, _}, path) do
[path]
end
end