From d864c0decfa56a61fd93a3b70154814a9af26bd1 Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Tue, 24 Oct 2023 09:49:06 +0800 Subject: [PATCH] ENH: add log_dir at the beginning of init JIRA: STUDIO-4895 Change-Id: I1eb1c4cee0383a01a6bacd2a70d7989bfb59006a --- src/slic3r/GUI/GUI_App.cpp | 8 +++++--- src/slic3r/Utils/NetworkAgent.cpp | 6 +++--- src/slic3r/Utils/NetworkAgent.hpp | 6 +++--- version.inc | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 590123a88..d738ad2ef 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -2892,14 +2892,16 @@ __retry: if (create_network_agent) { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", create network agent..."); - m_agent = new Slic3r::NetworkAgent(); + //std::string data_dir = wxStandardPaths::Get().GetUserDataDir().ToUTF8().data(); + std::string data_directory = data_dir(); + + m_agent = new Slic3r::NetworkAgent(data_directory); if (!m_device_manager) m_device_manager = new Slic3r::DeviceManager(m_agent); else m_device_manager->set_agent(m_agent); - //std::string data_dir = wxStandardPaths::Get().GetUserDataDir().ToUTF8().data(); - std::string data_directory = data_dir(); + //BBS set config dir if (m_agent) { diff --git a/src/slic3r/Utils/NetworkAgent.cpp b/src/slic3r/Utils/NetworkAgent.cpp index 791f016cb..fe79bd51b 100644 --- a/src/slic3r/Utils/NetworkAgent.cpp +++ b/src/slic3r/Utils/NetworkAgent.cpp @@ -114,12 +114,12 @@ func_put_rating_picture_oss NetworkAgent::put_rating_picture_oss_ptr = n func_get_model_mall_rating_result NetworkAgent::get_model_mall_rating_result_ptr = nullptr; -NetworkAgent::NetworkAgent() +NetworkAgent::NetworkAgent(std::string log_dir) { if (create_agent_ptr) { - network_agent = create_agent_ptr(); + network_agent = create_agent_ptr(log_dir); } - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", this %1%, network_agent=%2%, create_agent_ptr=%3%")%this %network_agent %create_agent_ptr; + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", this %1%, network_agent=%2%, create_agent_ptr=%3%, log_dir=%4%")%this %network_agent %create_agent_ptr %log_dir; } NetworkAgent::~NetworkAgent() diff --git a/src/slic3r/Utils/NetworkAgent.hpp b/src/slic3r/Utils/NetworkAgent.hpp index f2e5a0b60..49651fcf4 100644 --- a/src/slic3r/Utils/NetworkAgent.hpp +++ b/src/slic3r/Utils/NetworkAgent.hpp @@ -9,7 +9,7 @@ using namespace BBL; namespace Slic3r { typedef bool (*func_check_debug_consistent)(bool is_debug); typedef std::string (*func_get_version)(void); -typedef void* (*func_create_agent)(void); +typedef void* (*func_create_agent)(std::string log_dir); typedef int (*func_destroy_agent)(void *agent); typedef int (*func_init_log)(void *agent); typedef int (*func_set_config_dir)(void *agent, std::string config_dir); @@ -110,7 +110,7 @@ public: #endif static std::string get_version(); static void* get_network_function(const char* name); - NetworkAgent(); + NetworkAgent(std::string log_dir); ~NetworkAgent(); int init_log(); @@ -182,7 +182,7 @@ public: int get_profile_3mf(BBLProfile* profile); int get_model_publish_url(std::string* url); int get_subtask(BBLModelTask* task, OnGetSubTaskFn getsub_fn); - int get_model_mall_home_url(std::string* url); + int get_model_mall_home_url(std::string* url); int get_model_mall_detail_url(std::string* url, std::string id); int get_my_profile(std::string token, unsigned int* http_code, std::string* http_body); int track_enable(bool enable); diff --git a/version.inc b/version.inc index f38d68bd6..238e24e7c 100644 --- a/version.inc +++ b/version.inc @@ -12,4 +12,4 @@ set(BBL_INTERNAL_TESTING "1") endif() # The build_version should start from 50 in master branch -set(SLIC3R_VERSION "01.07.08.53") +set(SLIC3R_VERSION "01.07.09.50")