diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index cee9eafdc..1c2e846dd 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -544,6 +544,8 @@ void AppConfig::update_config_dir(const std::string &dir) void AppConfig::update_skein_dir(const std::string &dir) { + if (dir == sys_shapes_dir() || dir == custom_shapes_dir()) + return; // do not save "shapes gallery" directory this->set("recent", "skein_directory", dir); } /* diff --git a/src/libslic3r/Utils.hpp b/src/libslic3r/Utils.hpp index 330f05ec8..211755bbb 100644 --- a/src/libslic3r/Utils.hpp +++ b/src/libslic3r/Utils.hpp @@ -50,6 +50,9 @@ void set_sys_shapes_dir(const std::string &path); // Return a full path to the system shapes gallery directory. const std::string& sys_shapes_dir(); +// Return a full path to the custom shapes gallery directory. +std::string custom_shapes_dir(); + // Set a path with preset files. void set_data_dir(const std::string &path); // Return a full path to the GUI resource files. diff --git a/src/libslic3r/utils.cpp b/src/libslic3r/utils.cpp index 8f1cf07f2..3e38a3e67 100644 --- a/src/libslic3r/utils.cpp +++ b/src/libslic3r/utils.cpp @@ -202,6 +202,11 @@ const std::string& data_dir() return g_data_dir; } +std::string custom_shapes_dir() +{ + return (boost::filesystem::path(g_data_dir) / "shapes").string(); +} + #ifdef _WIN32 // The following helpers are borrowed from the LLVM project https://github.com/llvm namespace WindowsSupport diff --git a/src/slic3r/GUI/GalleryDialog.cpp b/src/slic3r/GUI/GalleryDialog.cpp index 539bcddbf..d64c09fb6 100644 --- a/src/slic3r/GUI/GalleryDialog.cpp +++ b/src/slic3r/GUI/GalleryDialog.cpp @@ -219,9 +219,7 @@ static void add_default_image(wxImageList* img_list, bool is_system) static fs::path get_dir(bool sys_dir) { - if (sys_dir) - return fs::absolute(fs::path(sys_shapes_dir())).make_preferred(); - return fs::absolute(fs::path(data_dir()) / "shapes").make_preferred(); + return fs::absolute(fs::path(sys_dir ? sys_shapes_dir() : custom_shapes_dir())).make_preferred(); } static std::string get_dir_path(bool sys_dir)