NEW:add the download path edit in the preferences

Change-Id: I8dfd3373a25bdd9d70360b61605d92f20052d478
This commit is contained in:
tao wang 2022-10-11 13:05:36 +08:00 committed by Lane.Wei
parent 79480405a0
commit b5979375b4
5 changed files with 88 additions and 3 deletions

View file

@ -1174,6 +1174,7 @@ GUI_App::GUI_App()
{
//app config initializes early becasuse it is used in instance checking in BambuStudio.cpp
this->init_app_config();
this->init_download_path();
reset_to_active();
}
@ -1764,6 +1765,26 @@ static boost::optional<Semver> parse_semver_from_ini(std::string path)
return Semver::parse(body);
}
void GUI_App::init_download_path()
{
std::string down_path = app_config->get("download_path");
if (down_path.empty()) {
std::string user_down_path = wxStandardPaths::Get().GetUserDir(wxStandardPaths::Dir_Downloads).ToUTF8().data();
app_config->set("download_path", user_down_path);
}
else {
fs::path dp(down_path);
if (!fs::exists(dp)) {
if (!fs::create_directory(dp)) {
std::string user_down_path = wxStandardPaths::Get().GetUserDir(wxStandardPaths::Dir_Downloads).ToUTF8().data();
app_config->set("download_path", user_down_path);
}
}
}
}
void GUI_App::init_app_config()
{
// Profiles for the alpha are stored into the PrusaSlicer-alpha directory to not mix with the current release.