From af97422ea9bd20899d04091740ca70d456514136 Mon Sep 17 00:00:00 2001 From: David Kocik Date: Mon, 29 Jan 2024 13:53:04 +0100 Subject: [PATCH] Store avatar png in temp folder --- src/slic3r/GUI/Plater.cpp | 3 ++- src/slic3r/GUI/TopBar.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 7f1a513c21..9b4874d9ed 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -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); diff --git a/src/slic3r/GUI/TopBar.cpp b/src/slic3r/GUI/TopBar.cpp index adc19cd421..5b06ac00a5 100644 --- a/src/slic3r/GUI/TopBar.cpp +++ b/src/slic3r/GUI/TopBar.cpp @@ -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);