mirror of
https://git.mirrors.martin98.com/https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-05 16:10:39 +08:00
create debug folder automatically
This commit is contained in:
parent
7699dbb272
commit
d45ac9201d
@ -5,8 +5,25 @@
|
|||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
void create_dir(const std::string& filePath)
|
||||||
|
{
|
||||||
|
boost::filesystem::path path(filePath);
|
||||||
|
boost::filesystem::path dir = path.parent_path();
|
||||||
|
|
||||||
|
if (!dir.empty()) {
|
||||||
|
if (!boost::filesystem::exists(dir)) {
|
||||||
|
try {
|
||||||
|
boost::filesystem::create_directories(dir);
|
||||||
|
} catch (const boost::filesystem::filesystem_error& e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool SVG::open(const char* afilename)
|
bool SVG::open(const char* afilename)
|
||||||
{
|
{
|
||||||
|
create_dir(afilename);
|
||||||
this->filename = afilename;
|
this->filename = afilename;
|
||||||
this->f = boost::nowide::fopen(afilename, "w");
|
this->f = boost::nowide::fopen(afilename, "w");
|
||||||
if (this->f == NULL)
|
if (this->f == NULL)
|
||||||
@ -25,6 +42,7 @@ bool SVG::open(const char* afilename)
|
|||||||
|
|
||||||
bool SVG::open(const char* afilename, const BoundingBox &bbox, const coord_t bbox_offset, bool aflipY)
|
bool SVG::open(const char* afilename, const BoundingBox &bbox, const coord_t bbox_offset, bool aflipY)
|
||||||
{
|
{
|
||||||
|
create_dir(afilename);
|
||||||
this->filename = afilename;
|
this->filename = afilename;
|
||||||
this->origin = bbox.min - Point(bbox_offset, bbox_offset);
|
this->origin = bbox.min - Point(bbox_offset, bbox_offset);
|
||||||
this->flipY = aflipY;
|
this->flipY = aflipY;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user