diff --git a/src/utils/SVG.cpp b/src/utils/SVG.cpp index 4da036996a..96899b4a4e 100644 --- a/src/utils/SVG.cpp +++ b/src/utils/SVG.cpp @@ -87,7 +87,7 @@ SVG::SVG(std::string filename, AABB aabb, double scale, Point2LL canvas_size, Co out_ = fopen(filename.c_str(), "w"); if (! out_) { - spdlog::error("The file %s could not be opened for writing.", filename); + spdlog::error("The file {} could not be opened for writing.", filename); } if (output_is_html_) { diff --git a/src/utils/polygonUtils.cpp b/src/utils/polygonUtils.cpp index 7f7bc2466a..dba28c5324 100644 --- a/src/utils/polygonUtils.cpp +++ b/src/utils/polygonUtils.cpp @@ -15,12 +15,15 @@ #include "utils/linearAlg2D.h" #ifdef DEBUG +#include #include #include "utils/AABB.h" #include "utils/SVG.h" #endif +namespace fs = std::filesystem; + namespace cura { @@ -693,12 +696,13 @@ ClosestPolygonPoint PolygonUtils::ensureInsideOrOutside( static bool has_run = false; if (! has_run) { + fs::path const debug_file_name = fs::temp_directory_path() / "debug.html"; try { int offset_performed = offset / 2; AABB aabb(polygons); aabb.expand(std::abs(preferred_dist_inside) * 2); - SVG svg("debug.html", aabb); + SVG svg(debug_file_name.string(), aabb); svg.writeComment("Original polygon in black"); svg.writePolygons(polygons, SVG::Color::BLACK); for (auto poly : polygons) @@ -729,7 +733,7 @@ ClosestPolygonPoint PolygonUtils::ensureInsideOrOutside( catch (...) { } - spdlog::error("Clipper::offset failed. See generated debug.html! Black is original Blue is offsetted polygon"); + spdlog::error("Clipper::offset failed. See generated {}! Black is original Blue is offsetted polygon", debug_file_name.string()); has_run = true; } #endif