mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 17:55:56 +08:00
Fix of opening avatar file for write.
This commit is contained in:
parent
2de65cfa6a
commit
f83213d958
@ -964,6 +964,10 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||||||
boost::filesystem::path path = user_account->get_avatar_path(true);
|
boost::filesystem::path path = user_account->get_avatar_path(true);
|
||||||
FILE* file;
|
FILE* file;
|
||||||
file = fopen(path.string().c_str(), "wb");
|
file = fopen(path.string().c_str(), "wb");
|
||||||
|
if (file == NULL) {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "Failed to create file to store avatar picture at: " << path;
|
||||||
|
return;
|
||||||
|
}
|
||||||
fwrite(evt.data.c_str(), 1, evt.data.size(), file);
|
fwrite(evt.data.c_str(), 1, evt.data.size(), file);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
this->main_frame->refresh_account_menu(true);
|
this->main_frame->refresh_account_menu(true);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "UserAccount.hpp"
|
#include "UserAccount.hpp"
|
||||||
|
|
||||||
#include "format.hpp"
|
#include "format.hpp"
|
||||||
|
#include "GUI.hpp"
|
||||||
|
|
||||||
#include "libslic3r/Utils.hpp"
|
#include "libslic3r/Utils.hpp"
|
||||||
|
|
||||||
@ -78,7 +79,7 @@ boost::filesystem::path UserAccount::get_avatar_path(bool logged) const
|
|||||||
{
|
{
|
||||||
if (logged) {
|
if (logged) {
|
||||||
const std::string filename = "prusaslicer-avatar-" + m_instance_hash + m_avatar_extension;
|
const std::string filename = "prusaslicer-avatar-" + m_instance_hash + m_avatar_extension;
|
||||||
return boost::filesystem::path(wxStandardPaths::Get().GetTempDir().utf8_str().data()) / filename;
|
return GUI::into_path(wxStandardPaths::Get().GetTempDir()) / filename;
|
||||||
} else {
|
} else {
|
||||||
return boost::filesystem::path(resources_dir()) / "icons" / "user.svg";
|
return boost::filesystem::path(resources_dir()) / "icons" / "user.svg";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user