From de3ba3c7941fa243dbb8d19196e620b77c6b6d14 Mon Sep 17 00:00:00 2001 From: supermerill Date: Mon, 9 Aug 2021 03:32:39 +0200 Subject: [PATCH] settings directory is now taken from a "configuration" directory if next to the "resources" one. Allow of a "portable version" without the --datadir needed. supermerill/SuperSlicer#1212 --- src/slic3r/GUI/GUI_App.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index d0d3940e6..a6a72e3c9 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -744,16 +744,21 @@ void GUI_App::init_app_config() // Mac : "~/Library/Application Support/Slic3r" if (data_dir().empty()) { - #ifndef __linux__ + //check if there is a "configuration" directory next to the resources + if (boost::filesystem::exists(boost::filesystem::path{ resources_dir() } / ".." / "configuration")) { + set_data_dir((boost::filesystem::path{ resources_dir() } / ".." / "configuration").string()); + } else { +#ifndef __linux__ set_data_dir(wxStandardPaths::Get().GetUserDataDir().ToUTF8().data()); - #else +#else // Since version 2.3, config dir on Linux is in ${XDG_CONFIG_HOME}. // https://github.com/prusa3d/PrusaSlicer/issues/2911 wxString dir; - if (! wxGetEnv(wxS("XDG_CONFIG_HOME"), &dir) || dir.empty() ) + if (!wxGetEnv(wxS("XDG_CONFIG_HOME"), &dir) || dir.empty()) dir = wxFileName::GetHomeDir() + wxS("/.config"); set_data_dir((dir + "/" + GetAppName()).ToUTF8().data()); - #endif +#endif + } } if (!app_config)