From 19079bc468fe6681a65887a42a9215a9ec7392d1 Mon Sep 17 00:00:00 2001
From: kingmo888 <17401091+kingmo888@users.noreply.github.com>
Date: Thu, 26 Sep 2024 08:46:09 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=A0=E6=97=A0logs?=
=?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9=E5=AF=BC=E8=87=B4=E5=90=AF=E5=8A=A8?=
=?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82c++?=
=?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=A2=9E=E5=8A=A0=20/utf8=E5=85=BC=E5=AE=B9?=
=?UTF-8?q?=EF=BC=8C=E8=A7=A3=E5=86=B3=E7=BC=96=E7=A0=81=E5=BC=82=E5=B8=B8?=
=?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
WeChatFerry/com/log.cpp | 6 +++++-
WeChatFerry/sdk/SDK.vcxproj | 1 +
WeChatFerry/spy/Spy.vcxproj | 2 +-
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/WeChatFerry/com/log.cpp b/WeChatFerry/com/log.cpp
index e06c0e9..6524dd0 100644
--- a/WeChatFerry/com/log.cpp
+++ b/WeChatFerry/com/log.cpp
@@ -14,7 +14,11 @@ void InitLogger(std::string path)
if (logger != nullptr) {
return;
}
-
+ // check and create logs folder
+ std::filesystem::path logDir = std::filesystem::path(path) / "logs";
+ if (!std::filesystem::exists(logDir)) {
+ std::filesystem::create_directory(logDir);
+ }
auto filename = std::filesystem::path(path + LOGGER_FILE_NAME).make_preferred().string();
try {
logger = spdlog::rotating_logger_mt(LOGGER_NAME, filename, LOGGER_MAX_SIZE, LOGGER_MAX_FILES);
diff --git a/WeChatFerry/sdk/SDK.vcxproj b/WeChatFerry/sdk/SDK.vcxproj
index af47a4b..a796526 100644
--- a/WeChatFerry/sdk/SDK.vcxproj
+++ b/WeChatFerry/sdk/SDK.vcxproj
@@ -117,6 +117,7 @@
true
MultiThreaded
+ /utf-8 %(AdditionalOptions)
Windows
diff --git a/WeChatFerry/spy/Spy.vcxproj b/WeChatFerry/spy/Spy.vcxproj
index 0c44f9a..02a49a0 100644
--- a/WeChatFerry/spy/Spy.vcxproj
+++ b/WeChatFerry/spy/Spy.vcxproj
@@ -192,7 +192,7 @@ xcopy /y $(OutDir)$(TargetFileName) $(SolutionDir)..\clients\python\wcferryfalse
4251;4731;4819
- /EHa %(AdditionalOptions)
+ /EHa /utf-8 %(AdditionalOptions)
MultiThreaded