mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 10:17:55 -06:00
Check and use data_dir folder if exists under application path (#6780)
This commit is contained in:
parent
c8216accfd
commit
6ca1741e83
1 changed files with 25 additions and 17 deletions
|
@ -1908,23 +1908,31 @@ void GUI_App::init_app_config()
|
||||||
// Mac : "~/Library/Application Support/Slic3r"
|
// Mac : "~/Library/Application Support/Slic3r"
|
||||||
|
|
||||||
if (data_dir().empty()) {
|
if (data_dir().empty()) {
|
||||||
boost::filesystem::path data_dir_path;
|
// Orca: check if data_dir folder exists in application folder
|
||||||
#ifndef __linux__
|
// use it if it exists
|
||||||
std::string data_dir = wxStandardPaths::Get().GetUserDataDir().ToUTF8().data();
|
boost::filesystem::path app_data_dir_path = boost::filesystem::current_path() / "data_dir";
|
||||||
//BBS create folder if not exists
|
if (boost::filesystem::exists(app_data_dir_path)) {
|
||||||
data_dir_path = boost::filesystem::path(data_dir);
|
set_data_dir(app_data_dir_path.string());
|
||||||
set_data_dir(data_dir);
|
}
|
||||||
#else
|
else{
|
||||||
// Since version 2.3, config dir on Linux is in ${XDG_CONFIG_HOME}.
|
boost::filesystem::path data_dir_path;
|
||||||
// https://github.com/prusa3d/PrusaSlicer/issues/2911
|
#ifndef __linux__
|
||||||
wxString dir;
|
std::string data_dir = wxStandardPaths::Get().GetUserDataDir().ToUTF8().data();
|
||||||
if (! wxGetEnv(wxS("XDG_CONFIG_HOME"), &dir) || dir.empty() )
|
//BBS create folder if not exists
|
||||||
dir = wxFileName::GetHomeDir() + wxS("/.config");
|
data_dir_path = boost::filesystem::path(data_dir);
|
||||||
set_data_dir((dir + "/" + GetAppName()).ToUTF8().data());
|
set_data_dir(data_dir);
|
||||||
data_dir_path = boost::filesystem::path(data_dir());
|
#else
|
||||||
#endif
|
// Since version 2.3, config dir on Linux is in ${XDG_CONFIG_HOME}.
|
||||||
if (!boost::filesystem::exists(data_dir_path)){
|
// https://github.com/prusa3d/PrusaSlicer/issues/2911
|
||||||
boost::filesystem::create_directory(data_dir_path);
|
wxString dir;
|
||||||
|
if (! wxGetEnv(wxS("XDG_CONFIG_HOME"), &dir) || dir.empty() )
|
||||||
|
dir = wxFileName::GetHomeDir() + wxS("/.config");
|
||||||
|
set_data_dir((dir + "/" + GetAppName()).ToUTF8().data());
|
||||||
|
data_dir_path = boost::filesystem::path(data_dir());
|
||||||
|
#endif
|
||||||
|
if (!boost::filesystem::exists(data_dir_path)){
|
||||||
|
boost::filesystem::create_directory(data_dir_path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change current dirtory of application
|
// Change current dirtory of application
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue