debugging function debug_output_path() moved to utils.cpp/hpp

and it now prints to console the default path when called for the first time.
Fixed compilation of debugging output in SupportMaterial.
This commit is contained in:
Vojtech Bubnik 2021-08-27 11:25:50 +02:00
parent f90b10b63e
commit ae8e0311d7
4 changed files with 75 additions and 64 deletions

View file

@ -207,6 +207,23 @@ std::string custom_shapes_dir()
return (boost::filesystem::path(g_data_dir) / "shapes").string();
}
static std::atomic<bool> debug_out_path_called(false);
std::string debug_out_path(const char *name, ...)
{
static constexpr const char *SLIC3R_DEBUG_OUT_PATH_PREFIX = "out/";
if (! debug_out_path_called.exchange(true)) {
std::string path = boost::filesystem::system_complete(SLIC3R_DEBUG_OUT_PATH_PREFIX).string();
printf("Debugging output files will be written to %s\n", path.c_str());
}
char buffer[2048];
va_list args;
va_start(args, name);
std::vsprintf(buffer, name, args);
va_end(args);
return std::string(SLIC3R_DEBUG_OUT_PATH_PREFIX) + std::string(buffer);
}
#ifdef _WIN32
// The following helpers are borrowed from the LLVM project https://github.com/llvm
namespace WindowsSupport