Add mapnik/filesystem.hpp ref:https://github.com/mapnik/mapnik/pull/4383#discussion_r1131405532
This commit is contained in:
parent
45b48721fa
commit
a244effa91
13 changed files with 109 additions and 137 deletions
43
include/mapnik/filesystem.hpp
Normal file
43
include/mapnik/filesystem.hpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2023 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef MAPNIK_FILESYSTEM_HPP
|
||||
#define MAPNIK_FILESYSTEM_HPP
|
||||
|
||||
#if defined(__cpp_lib_filesystem) && !defined(USE_BOOST_FILESYSTEM)
|
||||
#include <filesystem>
|
||||
#else
|
||||
#include <boost/filesystem/operations.hpp> // for absolute, exists, etc
|
||||
#include <boost/filesystem/path.hpp> // for path, operator/
|
||||
#endif
|
||||
|
||||
namespace mapnik {
|
||||
#if defined(__cpp_lib_filesystem) && !defined(USE_BOOST_FILESYSTEM)
|
||||
namespace fs = std::filesystem;
|
||||
using error_code = std::error_code;
|
||||
#else
|
||||
namespace fs = boost::filesystem;
|
||||
using error_code = boost::system::error_code;
|
||||
#endif
|
||||
} // namespace mapnik
|
||||
|
||||
#endif // MAPNIK_FILESYSTEM_HPP
|
15
src/fs.cpp
15
src/fs.cpp
|
@ -23,20 +23,7 @@
|
|||
// mapnik
|
||||
#include <mapnik/util/utf_conv_win.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
|
||||
#include <mapnik/warning.hpp>
|
||||
|
||||
#if __cplusplus >= 201703L && !defined(USE_BOOST_FILESYSTEM)
|
||||
#include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
#else
|
||||
MAPNIK_DISABLE_WARNING_PUSH
|
||||
#include <mapnik/warning_ignore.hpp>
|
||||
#include <boost/filesystem/operations.hpp> // for absolute, exists, etc
|
||||
#include <boost/filesystem/path.hpp> // for path, operator/
|
||||
MAPNIK_DISABLE_WARNING_POP
|
||||
namespace fs = boost::filesystem;
|
||||
#endif
|
||||
#include <mapnik/filesystem.hpp>
|
||||
|
||||
// stl
|
||||
#include <stdexcept>
|
||||
|
|
|
@ -8,18 +8,7 @@
|
|||
#include <mapnik/datasource.hpp>
|
||||
#include <mapnik/datasource_cache.hpp>
|
||||
#include <mapnik/debug.hpp>
|
||||
|
||||
#if __cplusplus >= 201703L && !defined(USE_BOOST_FILESYSTEM)
|
||||
#include <filesystem>
|
||||
#include <cstdio>
|
||||
namespace fs = std::filesystem;
|
||||
using error_code = std::error_code;
|
||||
#else
|
||||
#include <boost/filesystem.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
using error_code = boost::system::error_code;
|
||||
#endif
|
||||
|
||||
#include <mapnik/filesystem.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
|
||||
|
@ -42,13 +31,13 @@ std::string unique_mapnik_name()
|
|||
class tmp_dir
|
||||
{
|
||||
private:
|
||||
fs::path m_path;
|
||||
mapnik::fs::path m_path;
|
||||
|
||||
public:
|
||||
tmp_dir()
|
||||
: m_path(fs::temp_directory_path() / unique_mapnik_name())
|
||||
: m_path(mapnik::fs::temp_directory_path() / unique_mapnik_name())
|
||||
{
|
||||
fs::create_directories(m_path);
|
||||
mapnik::fs::create_directories(m_path);
|
||||
}
|
||||
|
||||
~tmp_dir()
|
||||
|
@ -57,16 +46,16 @@ class tmp_dir
|
|||
// running, which isn't necessarily an error as far as this
|
||||
// code is concerned - it just wants to delete everything
|
||||
// underneath the temporary directory.
|
||||
error_code err;
|
||||
mapnik::error_code err;
|
||||
|
||||
// catch all errors - we don't want to throw in the destructor
|
||||
try
|
||||
{
|
||||
// but loop while the path exists and the errors are
|
||||
// ignorable.
|
||||
while (fs::exists(m_path))
|
||||
while (mapnik::fs::exists(m_path))
|
||||
{
|
||||
fs::remove_all(m_path, err);
|
||||
mapnik::fs::remove_all(m_path, err);
|
||||
|
||||
// for any non-ignorable error, there's not much we can
|
||||
// do from the destructor. it's in /tmp anyway, so it'll
|
||||
|
@ -89,22 +78,22 @@ class tmp_dir
|
|||
}
|
||||
}
|
||||
|
||||
fs::path path() const { return m_path; }
|
||||
mapnik::fs::path path() const { return m_path; }
|
||||
};
|
||||
|
||||
void compare_map(fs::path xml)
|
||||
void compare_map(mapnik::fs::path xml)
|
||||
{
|
||||
tmp_dir dir;
|
||||
mapnik::Map m(256, 256);
|
||||
REQUIRE(m.register_fonts("fonts", true));
|
||||
fs::path abs_base = xml.parent_path();
|
||||
mapnik::fs::path abs_base = xml.parent_path();
|
||||
|
||||
// first, load the XML into a map object and save it. this
|
||||
// is a normalisation step to ensure that the file is in
|
||||
// whatever the current version of mapnik uses as the
|
||||
// standard indentation, quote style, etc...
|
||||
REQUIRE_NOTHROW(mapnik::load_map(m, xml.generic_string(), false, abs_base.generic_string()));
|
||||
fs::path test_map1 = dir.path() / "mapnik-temp-map1.xml";
|
||||
mapnik::fs::path test_map1 = dir.path() / "mapnik-temp-map1.xml";
|
||||
REQUIRE_NOTHROW(mapnik::save_map(m, test_map1.generic_string()));
|
||||
|
||||
// create a new map, load the one saved in the previous
|
||||
|
@ -112,23 +101,24 @@ void compare_map(fs::path xml)
|
|||
mapnik::Map new_map(256, 256);
|
||||
REQUIRE(new_map.register_fonts("fonts", true));
|
||||
REQUIRE_NOTHROW(mapnik::load_map(new_map, test_map1.generic_string(), false, abs_base.generic_string()));
|
||||
fs::path test_map2 = dir.path() / "mapnik-temp-map2.xml";
|
||||
mapnik::fs::path test_map2 = dir.path() / "mapnik-temp-map2.xml";
|
||||
REQUIRE_NOTHROW(mapnik::save_map(new_map, test_map2.generic_string()));
|
||||
|
||||
// if all the information survived the load/save round-trip
|
||||
// then the two files ought to be identical.
|
||||
REQUIRE(fs::is_regular_file(test_map1));
|
||||
REQUIRE(fs::is_regular_file(test_map2));
|
||||
REQUIRE(fs::file_size(test_map1) == fs::file_size(test_map2));
|
||||
REQUIRE(mapnik::fs::is_regular_file(test_map1));
|
||||
REQUIRE(mapnik::fs::is_regular_file(test_map2));
|
||||
REQUIRE(mapnik::fs::file_size(test_map1) == mapnik::fs::file_size(test_map2));
|
||||
std::ifstream in_map1(test_map1.native()), in_map2(test_map2.native());
|
||||
REQUIRE(std::equal(std::istream_iterator<char>(in_map1),
|
||||
std::istream_iterator<char>(),
|
||||
std::istream_iterator<char>(in_map2)));
|
||||
}
|
||||
|
||||
void add_xml_files(fs::path dir, std::vector<fs::path>& xml_files)
|
||||
void add_xml_files(mapnik::fs::path dir, std::vector<mapnik::fs::path>& xml_files)
|
||||
{
|
||||
for (auto const& entry : boost::make_iterator_range(fs::directory_iterator(dir), fs::directory_iterator()))
|
||||
for (auto const& entry :
|
||||
boost::make_iterator_range(mapnik::fs::directory_iterator(dir), mapnik::fs::directory_iterator()))
|
||||
{
|
||||
auto path = entry.path();
|
||||
if (path.extension().generic_string() == ".xml")
|
||||
|
@ -138,7 +128,7 @@ void add_xml_files(fs::path dir, std::vector<fs::path>& xml_files)
|
|||
}
|
||||
}
|
||||
|
||||
void load_map(mapnik::Map& m, fs::path const& path)
|
||||
void load_map(mapnik::Map& m, mapnik::fs::path const& path)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -161,7 +151,7 @@ void load_map(mapnik::Map& m, fs::path const& path)
|
|||
} // anonymous namespace
|
||||
#ifndef MAPNIK_STATIC_PLUGINS
|
||||
const bool registered =
|
||||
mapnik::datasource_cache::instance().register_datasources((fs::path("plugins") / "input").generic_string());
|
||||
mapnik::datasource_cache::instance().register_datasources((mapnik::fs::path("plugins") / "input").generic_string());
|
||||
#endif
|
||||
TEST_CASE("map xml I/O")
|
||||
{
|
||||
|
@ -177,8 +167,8 @@ TEST_CASE("map xml I/O")
|
|||
|
||||
SECTION("good maps")
|
||||
{
|
||||
std::vector<fs::path> good_maps;
|
||||
add_xml_files(fs::path("test") / "data" / "good_maps", good_maps);
|
||||
std::vector<mapnik::fs::path> good_maps;
|
||||
add_xml_files(mapnik::fs::path("test") / "data" / "good_maps", good_maps);
|
||||
|
||||
for (auto const& path : good_maps)
|
||||
{
|
||||
|
@ -197,7 +187,7 @@ TEST_CASE("map xml I/O")
|
|||
SECTION("duplicate styles only throw in strict mode")
|
||||
{
|
||||
std::string duplicate_stylename(
|
||||
(fs::path("test") / "data" / "broken_maps" / "duplicate_stylename.xml").generic_string());
|
||||
(mapnik::fs::path("test") / "data" / "broken_maps" / "duplicate_stylename.xml").generic_string());
|
||||
CAPTURE(duplicate_stylename);
|
||||
mapnik::Map m(256, 256);
|
||||
REQUIRE(m.register_fonts("fonts", true));
|
||||
|
@ -209,9 +199,9 @@ TEST_CASE("map xml I/O")
|
|||
|
||||
SECTION("broken maps")
|
||||
{
|
||||
std::vector<fs::path> broken_maps;
|
||||
add_xml_files(fs::path("test") / "data" / "broken_maps", broken_maps);
|
||||
broken_maps.emplace_back(fs::path("test") / "data" / "broken_maps" / "does_not_exist.xml");
|
||||
std::vector<mapnik::fs::path> broken_maps;
|
||||
add_xml_files(mapnik::fs::path("test") / "data" / "broken_maps", broken_maps);
|
||||
broken_maps.emplace_back(mapnik::fs::path("test") / "data" / "broken_maps" / "does_not_exist.xml");
|
||||
|
||||
for (auto const& path : broken_maps)
|
||||
{
|
||||
|
|
|
@ -20,21 +20,12 @@ MAPNIK_DISABLE_WARNING_PUSH
|
|||
#include <boost/optional/optional_io.hpp>
|
||||
MAPNIK_DISABLE_WARNING_POP
|
||||
|
||||
#if __cplusplus >= 201703L && !defined(USE_BOOST_FILESYSTEM)
|
||||
#include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
#else
|
||||
MAPNIK_DISABLE_WARNING_PUSH
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
MAPNIK_DISABLE_WARNING_POP
|
||||
namespace fs = boost::filesystem;
|
||||
#endif
|
||||
|
||||
#include <mapnik/filesystem.hpp>
|
||||
#include <mapnik/util/mapped_memory_file.hpp>
|
||||
|
||||
inline void make_directory(std::string const& dir)
|
||||
{
|
||||
fs::create_directories(dir);
|
||||
mapnik::fs::create_directories(dir);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -1,20 +1,8 @@
|
|||
#include "catch.hpp"
|
||||
|
||||
#include <mapnik/cairo_io.hpp>
|
||||
#include <mapnik/filesystem.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
|
||||
#include <mapnik/warning.hpp>
|
||||
#if __cplusplus >= 201703L && !defined(USE_BOOST_FILESYSTEM)
|
||||
#include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
#else
|
||||
MAPNIK_DISABLE_WARNING_PUSH
|
||||
#include <mapnik/warning_ignore.hpp>
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
MAPNIK_DISABLE_WARNING_POP
|
||||
namespace fs = boost::filesystem;
|
||||
#endif
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#if defined(HAVE_CAIRO)
|
||||
|
@ -28,7 +16,7 @@ TEST_CASE("cairo_io")
|
|||
SECTION("save_to_cairo_file - SVG")
|
||||
{
|
||||
std::string directory_name("/tmp/mapnik-tests/");
|
||||
fs::create_directories(directory_name);
|
||||
mapnik::fs::create_directories(directory_name);
|
||||
REQUIRE(mapnik::util::exists(directory_name));
|
||||
|
||||
std::string output_file(directory_name + "test_save_to_cairo_file.svg");
|
||||
|
|
|
@ -3,15 +3,9 @@
|
|||
|
||||
#include <string>
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#include <mapnik/filesystem.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <mapnik/datasource_cache.hpp>
|
||||
#if __cplusplus >= 201703L && !defined(USE_BOOST_FILESYSTEM)
|
||||
#include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
#else
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
#endif
|
||||
|
||||
#include "cleanup.hpp" // run_cleanup()
|
||||
|
||||
|
@ -49,7 +43,7 @@ int main(int argc, char** argv)
|
|||
std::clog << "Could not find " << working_dir << "\n";
|
||||
return -1;
|
||||
}
|
||||
fs::current_path(working_dir);
|
||||
mapnik::fs::current_path(working_dir);
|
||||
}
|
||||
|
||||
if (result == 0)
|
||||
|
|
|
@ -28,16 +28,7 @@
|
|||
#include <set>
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
|
||||
#if __cplusplus >= 201703L && !defined(USE_BOOST_FILESYSTEM)
|
||||
#include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
#else
|
||||
// boost
|
||||
#include <boost/filesystem.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
#endif
|
||||
|
||||
#include <mapnik/filesystem.hpp>
|
||||
#include <mapnik/geometry/box2d.hpp>
|
||||
|
||||
namespace visual_tests {
|
||||
|
@ -82,8 +73,8 @@ struct result
|
|||
map_size size;
|
||||
map_size tiles;
|
||||
double scale_factor;
|
||||
fs::path actual_image_path;
|
||||
fs::path reference_image_path;
|
||||
mapnik::fs::path actual_image_path;
|
||||
mapnik::fs::path reference_image_path;
|
||||
std::string error_message;
|
||||
unsigned diff;
|
||||
std::chrono::high_resolution_clock::duration duration;
|
||||
|
|
|
@ -57,14 +57,7 @@
|
|||
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L && !defined(USE_BOOST_FILESYSTEM)
|
||||
#include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
#else
|
||||
// boost
|
||||
#include <boost/filesystem.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
#endif
|
||||
#include <mapnik/filesystem.hpp>
|
||||
|
||||
namespace visual_tests {
|
||||
|
||||
|
@ -76,7 +69,7 @@ struct raster_renderer_base
|
|||
static constexpr const char* ext = ".png";
|
||||
static constexpr const bool support_tiles = true;
|
||||
|
||||
unsigned compare(image_type const& actual, fs::path const& reference) const
|
||||
unsigned compare(image_type const& actual, mapnik::fs::path const& reference) const
|
||||
{
|
||||
std::unique_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(reference.string(), "png"));
|
||||
if (!reader.get())
|
||||
|
@ -90,7 +83,7 @@ struct raster_renderer_base
|
|||
return mapnik::compare(actual, reference_image, 0, true);
|
||||
}
|
||||
|
||||
void save(image_type const& image, fs::path const& path) const
|
||||
void save(image_type const& image, mapnik::fs::path const& path) const
|
||||
{
|
||||
mapnik::save_to_file(image, path.string(), "png32");
|
||||
}
|
||||
|
@ -102,7 +95,7 @@ struct vector_renderer_base
|
|||
|
||||
static constexpr const bool support_tiles = false;
|
||||
|
||||
unsigned compare(image_type const& actual, fs::path const& reference) const
|
||||
unsigned compare(image_type const& actual, mapnik::fs::path const& reference) const
|
||||
{
|
||||
std::ifstream stream(reference.string().c_str(), std::ios_base::in | std::ios_base::binary);
|
||||
if (!stream)
|
||||
|
@ -113,7 +106,7 @@ struct vector_renderer_base
|
|||
return std::max(actual.size(), expected.size()) - std::min(actual.size(), expected.size());
|
||||
}
|
||||
|
||||
void save(image_type const& image, fs::path const& path) const
|
||||
void save(image_type const& image, mapnik::fs::path const& path) const
|
||||
{
|
||||
std::ofstream file(path.string().c_str(), std::ios::out | std::ios::trunc | std::ios::binary);
|
||||
if (!file)
|
||||
|
@ -308,7 +301,7 @@ class renderer
|
|||
using renderer_type = Renderer;
|
||||
using image_type = typename Renderer::image_type;
|
||||
|
||||
renderer(fs::path const& _output_dir, fs::path const& _reference_dir, bool _overwrite)
|
||||
renderer(mapnik::fs::path const& _output_dir, mapnik::fs::path const& _reference_dir, bool _overwrite)
|
||||
: ren()
|
||||
, output_dir(_output_dir)
|
||||
, reference_dir(_reference_dir)
|
||||
|
@ -346,8 +339,8 @@ class renderer
|
|||
map_size const& tiles,
|
||||
double scale_factor) const
|
||||
{
|
||||
fs::path reference = reference_dir / image_file_name(name, size, tiles, scale_factor, true);
|
||||
bool reference_exists = fs::exists(reference);
|
||||
mapnik::fs::path reference = reference_dir / image_file_name(name, size, tiles, scale_factor, true);
|
||||
bool reference_exists = mapnik::fs::exists(reference);
|
||||
result res;
|
||||
|
||||
res.state = reference_exists ? STATE_OK : STATE_OVERWRITE;
|
||||
|
@ -361,8 +354,8 @@ class renderer
|
|||
|
||||
if (res.diff)
|
||||
{
|
||||
fs::create_directories(output_dir);
|
||||
fs::path path = output_dir / image_file_name(name, size, tiles, scale_factor, false);
|
||||
mapnik::fs::create_directories(output_dir);
|
||||
mapnik::fs::path path = output_dir / image_file_name(name, size, tiles, scale_factor, false);
|
||||
res.actual_image_path = path;
|
||||
res.state = STATE_FAIL;
|
||||
ren.save(image, path);
|
||||
|
@ -400,8 +393,8 @@ class renderer
|
|||
}
|
||||
|
||||
const Renderer ren;
|
||||
const fs::path output_dir;
|
||||
const fs::path reference_dir;
|
||||
const mapnik::fs::path output_dir;
|
||||
const mapnik::fs::path reference_dir;
|
||||
const bool overwrite;
|
||||
};
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ void console_short_report::report(result const& r)
|
|||
}
|
||||
}
|
||||
|
||||
void html_report::report(result const& r, fs::path const& output_dir)
|
||||
void html_report::report(result const& r, mapnik::fs::path const& output_dir)
|
||||
{
|
||||
if (r.state == STATE_ERROR)
|
||||
{
|
||||
|
@ -180,8 +180,7 @@ void html_report::report(result const& r, fs::path const& output_dir)
|
|||
}
|
||||
else if (r.state == STATE_FAIL)
|
||||
{
|
||||
using namespace fs;
|
||||
|
||||
using namespace mapnik::fs;
|
||||
path reference = output_dir / r.reference_image_path.filename();
|
||||
path actual = output_dir / r.actual_image_path.filename();
|
||||
|
||||
|
@ -238,7 +237,7 @@ constexpr const char* html_footer = R"template(</div>
|
|||
</body>
|
||||
</html>)template";
|
||||
|
||||
void html_report::summary(result_list const& results, fs::path const& output_dir)
|
||||
void html_report::summary(result_list const& results, mapnik::fs::path const& output_dir)
|
||||
{
|
||||
s << html_header;
|
||||
|
||||
|
@ -253,11 +252,11 @@ void html_report::summary(result_list const& results, fs::path const& output_dir
|
|||
s << html_footer;
|
||||
}
|
||||
|
||||
void html_summary(result_list const& results, fs::path output_dir)
|
||||
void html_summary(result_list const& results, mapnik::fs::path output_dir)
|
||||
{
|
||||
fs::path html_root = output_dir / "visual-test-results";
|
||||
fs::create_directories(html_root);
|
||||
fs::path html_report_path = html_root / "index.html";
|
||||
mapnik::fs::path html_root = output_dir / "visual-test-results";
|
||||
mapnik::fs::create_directories(html_root);
|
||||
mapnik::fs::path html_report_path = html_root / "index.html";
|
||||
std::clog << "View failure report at " << html_report_path << "\n";
|
||||
std::ofstream output_file(html_report_path.string());
|
||||
html_report report(output_file);
|
||||
|
|
|
@ -76,8 +76,8 @@ class html_report
|
|||
: s(_s)
|
||||
{}
|
||||
|
||||
void report(result const& r, fs::path const& output_dir);
|
||||
void summary(result_list const& results, fs::path const& output_dir);
|
||||
void report(result const& r, mapnik::fs::path const& output_dir);
|
||||
void summary(result_list const& results, mapnik::fs::path const& output_dir);
|
||||
|
||||
protected:
|
||||
std::ostream& s;
|
||||
|
@ -119,7 +119,7 @@ class summary_visitor
|
|||
result_list const& result_;
|
||||
};
|
||||
|
||||
void html_summary(result_list const& results, fs::path output_dir);
|
||||
void html_summary(result_list const& results, mapnik::fs::path output_dir);
|
||||
|
||||
} // namespace visual_tests
|
||||
|
||||
|
|
|
@ -59,19 +59,15 @@ std::string unique_name()
|
|||
{
|
||||
std::mt19937 gen(entropy());
|
||||
std::uniform_int_distribution<> distrib(0, 65535);
|
||||
auto fmt = boost::format("%1$04x-%2$04x-%3$04x-%4$04x")
|
||||
% distrib(gen)
|
||||
% distrib(gen)
|
||||
% distrib(gen)
|
||||
%distrib(gen);
|
||||
auto fmt = boost::format("%1$04x-%2$04x-%3$04x-%4$04x") % distrib(gen) % distrib(gen) % distrib(gen) % distrib(gen);
|
||||
return fmt.str();
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
runner::renderer_container
|
||||
create_renderers(po::variables_map const& args, fs::path const& output_dir, bool force_append = false)
|
||||
create_renderers(po::variables_map const& args, mapnik::fs::path const& output_dir, bool force_append = false)
|
||||
{
|
||||
fs::path reference_dir(args["images-dir"].as<std::string>());
|
||||
mapnik::fs::path reference_dir(args["images-dir"].as<std::string>());
|
||||
bool overwrite = args.count("overwrite");
|
||||
runner::renderer_container renderers;
|
||||
|
||||
|
@ -205,7 +201,7 @@ int main(int argc, char** argv)
|
|||
mapnik::freetype_engine::register_fonts(vm["fonts"].as<std::string>(), true);
|
||||
mapnik::datasource_cache::instance().register_datasources(vm["plugins"].as<std::string>());
|
||||
|
||||
fs::path output_dir(vm["output-dir"].as<std::string>());
|
||||
mapnik::fs::path output_dir(vm["output-dir"].as<std::string>());
|
||||
|
||||
if (vm.count("unique-subdir"))
|
||||
{
|
||||
|
|
|
@ -149,8 +149,8 @@ runner::runner(runner::path_type const& styles_dir,
|
|||
|
||||
result_list runner::test_all(report_type& report) const
|
||||
{
|
||||
fs::directory_iterator begin(styles_dir_);
|
||||
fs::directory_iterator end;
|
||||
mapnik::fs::directory_iterator begin(styles_dir_);
|
||||
mapnik::fs::directory_iterator end;
|
||||
std::vector<runner::path_type> files(begin, end);
|
||||
return test_parallel(files, report, jobs_);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace visual_tests {
|
|||
|
||||
class runner
|
||||
{
|
||||
using path_type = fs::path;
|
||||
using path_type = mapnik::fs::path;
|
||||
using files_iterator = std::vector<path_type>::const_iterator;
|
||||
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue