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
This commit is contained in:
supermerill 2021-08-09 03:32:39 +02:00
parent 5265c85c82
commit de3ba3c794

View File

@ -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)