mirror of
https://git.mirrors.martin98.com/https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-15 00:55:56 +08:00
Fixed a regression issue when starting Slic3r with non-existent datadir.
This commit is contained in:
parent
830da1f8e4
commit
8807d288d7
@ -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…
x
Reference in New Issue
Block a user