mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-17 19:57:55 -06:00
Fixed a regression issue when starting Slic3r with non-existent datadir.
This commit is contained in:
parent
830da1f8e4
commit
8807d288d7
1 changed files with 5 additions and 6 deletions
|
@ -64,12 +64,11 @@ PresetBundle::~PresetBundle()
|
||||||
|
|
||||||
void PresetBundle::setup_directories()
|
void PresetBundle::setup_directories()
|
||||||
{
|
{
|
||||||
boost::filesystem::path dir = boost::filesystem::canonical(Slic3r::data_dir());
|
boost::filesystem::path data_dir = boost::filesystem::path(Slic3r::data_dir());
|
||||||
if (! boost::filesystem::is_directory(dir))
|
std::initializer_list<boost::filesystem::path> paths = { data_dir, data_dir / "print", data_dir / "filament", data_dir / "printer" };
|
||||||
throw std::runtime_error(std::string("datadir does not exist: ") + Slic3r::data_dir());
|
for (const boost::filesystem::path &path : paths) {
|
||||||
std::initializer_list<const char*> names = { "print", "filament", "printer" };
|
boost::filesystem::path subdir = path;
|
||||||
for (const char *name : names) {
|
subdir.make_preferred();
|
||||||
boost::filesystem::path subdir = (dir / name).make_preferred();
|
|
||||||
if (! boost::filesystem::is_directory(subdir) &&
|
if (! boost::filesystem::is_directory(subdir) &&
|
||||||
! boost::filesystem::create_directory(subdir))
|
! boost::filesystem::create_directory(subdir))
|
||||||
throw std::runtime_error(std::string("Slic3r was unable to create its data directory at ") + subdir.string());
|
throw std::runtime_error(std::string("Slic3r was unable to create its data directory at ") + subdir.string());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue