Browse Source

Z991239-914 #comment other: 路径分隔符用宏替代

翟俊伟80258120 5 years ago
parent
commit
16584e8808
1 changed files with 26 additions and 9 deletions
  1. 26 9
      Module/mod_CustMngrAuth/CustMngrAuthFSM.cpp

+ 26 - 9
Module/mod_CustMngrAuth/CustMngrAuthFSM.cpp

@@ -12,10 +12,12 @@
 #include <sstream>
 #include <thread>
 #include <chrono>
+#include <time.h>
+#include "path.h"
 
 using namespace std;
 #define _ATL_NO_AUTOMATIC_NAMESPACE
-#include <atltime.h>
+//#include <atltime.h>
 
 const int UPDATEINTERNAL = 10*60*1000;	//query data from branch server internal, 10min
 const int CONNECTINTERNAL = 30*1000;	//connect branch server internal, 30s
@@ -373,7 +375,10 @@ bool CCustMngrAuthFSM::ReadDataIntoMemory(bool& bHasData)
 	ErrorCodeEnum eErr;
 
 	CSimpleStringA strPath;
-	CSimpleStringA runInfoFile = m_runInfoPath + "\\runcfg\\CustMngrAuth.ini";
+	CSimpleStringA runInfoFile;
+	runInfoFile = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "runcfg" SPLIT_SLASH_STR "CustMngrAuth.ini"
+										, (const char*)m_runInfoPath);
+
 	ifstream inFile(runInfoFile);
 	string line;
 	int customerNum = 0;
@@ -588,8 +593,12 @@ void CCustMngrAuthFSM::FeatureUpdate()
 			Dbg("Transmission finished successfully. Ready to decode json data and write into runcfg");
 
 			//写入文件前,先判断是否已存在CustMngrAuth.ini文件,若不存在则直接写入,若存在,则先备份该文件
-			CSimpleStringA srcFile = m_runInfoPath + "\\runcfg\\CustMngrAuth.ini";
-			CSimpleStringA backupFile = m_runInfoPath + "\\runcfg\\CustMngrAuth_bak.ini";
+			CSimpleStringA srcFile(true);
+			CSimpleStringA backupFile(true);
+			srcFile = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "runcfg" SPLIT_SLASH_STR "CustMngrAuth.ini"
+											, (const char*)m_runInfoPath);
+			backupFile = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "runcfg" SPLIT_SLASH_STR "CustMngrAuth_bak.ini"
+											, (const char*)m_runInfoPath);
 
 			EnterCriticalSection(&m_cs);
 			if(!BackupFile(srcFile, backupFile)){
@@ -1013,7 +1022,10 @@ ErrorCodeEnum CCustMngrAuthFSM::CollectFingerPrint(SpReqAnsContext<CustMngrAuthS
 			getImgNum += 1;
 			BroadcastPressFinger(i+1, false);//lift finger
 			CBlob data;
-			eErr = GetImgBlob(data, strPath + "\\" + gifAns.imageName);
+			CSimpleStringA tempFullPath;
+			tempFullPath = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s"
+												, (const char*)strPath, (const char*)gifAns.imageName);
+			eErr = GetImgBlob(data, tempFullPath);
 			if (eErr != Error_Succeed){
 				Dbg("Failed to load finger image.");
 				break;
@@ -1046,11 +1058,16 @@ ErrorCodeEnum CCustMngrAuthFSM::CollectFingerPrint(SpReqAnsContext<CustMngrAuthS
 	}
 
 	//delete bmp files in dep
-	for (int j = 0; j < getImgNum; ++j){
-		if(remove(strPath + "\\" + (const char*)imgPaths[j])==0)
-			Dbg("finger image %s deleted!", strPath + "\\" + (const char*)imgPaths[j]);
+	for (int j = 0; j < getImgNum; ++j)
+	{
+		CSimpleStringA tempFullPath(true);
+		tempFullPath = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s"
+											, (const char*)strPath, (const char*)imgPaths[j]);
+
+		if(remove((const char*)tempFullPath) == 0)
+			Dbg("finger image %s deleted!", (const char*)tempFullPath);
 		else
-			Dbg("fail to delete image %s!", strPath + "\\" + (const char*)imgPaths[j]);
+			Dbg("fail to delete image %s!", (const char*)tempFullPath);
 	}
 	
 	if (eErr == Error_Succeed){