From f48732b2178bbaf64f39099391832a6f271fed4d Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期六, 13 九月 2025 16:15:09 +0800
Subject: [PATCH] 1. SG精度检保存界面上的参数到配置文件 2. SG精度检允许设置开机自启动 3. 修改日志保存路径

---
 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