From e8a27bb203fe2aff70390a5eca002d7438da9b0f Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期三, 22 十月 2025 14:24:34 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang
---
SourceCode/Bond/SGMeasurement/Logger.cpp | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/SourceCode/Bond/SGMeasurement/Logger.cpp b/SourceCode/Bond/SGMeasurement/Logger.cpp
index ecc94fd..e89b795 100644
--- a/SourceCode/Bond/SGMeasurement/Logger.cpp
+++ b/SourceCode/Bond/SGMeasurement/Logger.cpp
@@ -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