better error reporting when no valid files are passed to mapnik-index

This commit is contained in:
Dane Springmeyer 2015-10-20 14:49:58 -07:00
parent 1df6fbb17e
commit cd5b97b01f

View file

@ -133,19 +133,34 @@ int main (int argc, char** argv)
return EXIT_FAILURE; return EXIT_FAILURE;
} }
std::clog << "max tree depth:" << depth << std::endl; std::vector<std::string> files_to_process;
std::clog << "split ratio:" << ratio << std::endl;
if (files.size() == 0) for (auto const& filename : files)
{
if (!mapnik::util::exists(filename))
{
continue;
}
if (mapnik::detail::is_csv(filename) || mapnik::detail::is_geojson(filename))
{
files_to_process.push_back(filename);
}
}
if (files_to_process.size() == 0)
{ {
std::clog << "no files to index" << std::endl; std::clog << "no files to index" << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
std::clog << "max tree depth:" << depth << std::endl;
std::clog << "split ratio:" << ratio << std::endl;
using box_type = mapnik::box2d<double>; using box_type = mapnik::box2d<double>;
using item_type = std::pair<box_type, std::pair<std::size_t, std::size_t>>; using item_type = std::pair<box_type, std::pair<std::size_t, std::size_t>>;
for (auto const& filename : files) for (auto const& filename : files_to_process)
{ {
if (!mapnik::util::exists(filename)) if (!mapnik::util::exists(filename))
{ {