From 8807d288d7af21727dd371d5bcf6d9e68f02d229 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Thu, 30 Nov 2017 15:51:51 +0100 Subject: [PATCH] Fixed a regression issue when starting Slic3r with non-existent datadir. --- xs/src/slic3r/GUI/PresetBundle.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/xs/src/slic3r/GUI/PresetBundle.cpp b/xs/src/slic3r/GUI/PresetBundle.cpp index 3855760c26..29afc07cd6 100644 --- a/xs/src/slic3r/GUI/PresetBundle.cpp +++ b/xs/src/slic3r/GUI/PresetBundle.cpp @@ -64,12 +64,11 @@ PresetBundle::~PresetBundle() void PresetBundle::setup_directories() { - boost::filesystem::path dir = boost::filesystem::canonical(Slic3r::data_dir()); - if (! boost::filesystem::is_directory(dir)) - throw std::runtime_error(std::string("datadir does not exist: ") + Slic3r::data_dir()); - std::initializer_list names = { "print", "filament", "printer" }; - for (const char *name : names) { - boost::filesystem::path subdir = (dir / name).make_preferred(); + boost::filesystem::path data_dir = boost::filesystem::path(Slic3r::data_dir()); + std::initializer_list paths = { data_dir, data_dir / "print", data_dir / "filament", data_dir / "printer" }; + for (const boost::filesystem::path &path : paths) { + boost::filesystem::path subdir = path; + subdir.make_preferred(); if (! boost::filesystem::is_directory(subdir) && ! boost::filesystem::create_directory(subdir)) throw std::runtime_error(std::string("Slic3r was unable to create its data directory at ") + subdir.string());