From 829fe6c6bc33d53fda9c31fd45a37e1df87befff Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期五, 30 一月 2026 11:16:24 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang
---
SourceCode/Bond/SGMeasurement/Logger.cpp | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/SourceCode/Bond/SGMeasurement/Logger.cpp b/SourceCode/Bond/SGMeasurement/Logger.cpp
index 34a0dd1..e89b795 100644
--- a/SourceCode/Bond/SGMeasurement/Logger.cpp
+++ b/SourceCode/Bond/SGMeasurement/Logger.cpp
@@ -1,4 +1,4 @@
-#include "pch.h"
+锘�#include "pch.h"
#include "Logger.h"
CLogger& CLogger::Instance()
@@ -21,8 +21,17 @@
{
CSingleLock lock(&m_csLogLock, TRUE);
+ TCHAR szPath[MAX_PATH] = { 0 };
+ GetModuleFileName(NULL, szPath, MAX_PATH);
+
+ CString strPath = szPath;
+ int pos = strPath.ReverseFind('\\');
+ if (pos != -1) {
+ strPath = strPath.Left(pos + 1);
+ }
+
CTime now = CTime::GetCurrentTime();
- CString strLogDir = _T("Log");
+ CString strLogDir = strPath + _T("Log");
if (!PathFileExists(strLogDir)) {
CreateDirectory(strLogDir, NULL);
@@ -37,8 +46,7 @@
m_logFile.Close();
}
- if (m_logFile.Open(strNewPath,
- CFile::modeCreate | CFile::modeNoTruncate | CFile::modeWrite | CFile::typeBinary)) {
+ if (m_logFile.Open(strNewPath, CFile::modeCreate | CFile::modeNoTruncate | CFile::modeWrite | CFile::typeBinary | CFile::shareDenyWrite)) {
if (m_logFile.GetLength() == 0) {
WCHAR bom = 0xFEFF;
--
Gitblit v1.9.3