Store avatar png in temp folder

This commit is contained in:
David Kocik 2024-01-29 13:53:04 +01:00
parent e9706f4032
commit af97422ea9
2 changed files with 4 additions and 2 deletions

View File

@ -951,7 +951,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
}
});
this->q->Bind(EVT_UA_AVATAR_SUCCESS, [this](UserAccountSuccessEvent& evt) {
boost::filesystem::path png_path = boost::filesystem::path(Slic3r::data_dir()) / "cache" / "avatar.png";
const std::string filename = "prusaslicer-avatar-" + wxGetApp().get_instance_hash_string() + ".png";
const boost::filesystem::path png_path = boost::filesystem::path(wxStandardPaths::Get().GetTempDir().utf8_str().data()) / filename;
FILE* file;
file = fopen(png_path.string().c_str(), "wb");
fwrite(evt.data.c_str(), 1, evt.data.size(), file);

View File

@ -202,7 +202,8 @@ void TopBarItemsCtrl::UpdateAccountMenu(bool avatar/* = false*/)
m_account_btn->SetLabel(user_name);
if (avatar) {
if (user_account->is_logged()) {
boost::filesystem::path path = boost::filesystem::path(boost::filesystem::path(Slic3r::data_dir()) / "cache" / "avatar.png");
const std::string filename = "prusaslicer-avatar-" + wxGetApp().get_instance_hash_string() + ".png";
boost::filesystem::path path = boost::filesystem::path(wxStandardPaths::Get().GetTempDir().utf8_str().data()) / filename;
ScalableBitmap new_logo(this, path, m_account_btn->GetBitmapSize());
if (new_logo.IsOk())
m_account_btn->SetBitmap_(new_logo);