Skip to content

Commit a68cc36

Browse files
committed
fixed:Incorrect path parameter for enumeration file
1 parent 0db4715 commit a68cc36

File tree

2 files changed

+55
-2
lines changed

2 files changed

+55
-2
lines changed

XEngine_Source/StorageModule_APIHelp/APIHelp_Distributed/APIHelp_Distributed.cpp

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,26 @@ BOOL CAPIHelp_Distributed::APIHelp_Distributed_UPStorage(LPCTSTR lpszMsgBuffer,
287287
int nListCount = 0;
288288
__int64u nDirCount = 0; //当前目录大小
289289
CHAR** ppListFile;
290-
SystemApi_File_EnumFile(pSt_StorageBucket->tszFilePath, &ppListFile, &nListCount, NULL, NULL, TRUE, 1);
290+
291+
TCHAR tszFilePath[MAX_PATH];
292+
memset(tszFilePath, '\0', MAX_PATH);
293+
294+
_tcscpy(tszFilePath, pSt_StorageBucket->tszFilePath);
295+
if (tszFilePath[_tcslen(tszFilePath) - 1] != '*')
296+
{
297+
int nPathType = 0;
298+
BaseLib_OperatorString_GetPath(tszFilePath, &nPathType);
299+
//判断是绝对路径还是相对路径
300+
if (1 == nPathType)
301+
{
302+
_tcscat(tszFilePath, _T("\\*"));
303+
}
304+
else if (2 == nPathType)
305+
{
306+
_tcscat(tszFilePath, _T("/*"));
307+
}
308+
}
309+
SystemApi_File_EnumFile(tszFilePath, &ppListFile, &nListCount, NULL, NULL, TRUE, 1);
291310
for (int j = 0; j < nListCount; j++)
292311
{
293312
struct _tstat64 st_FStat;
@@ -331,7 +350,26 @@ BOOL CAPIHelp_Distributed::APIHelp_Distributed_UPStorage(LPCTSTR lpszMsgBuffer,
331350
int nListCount = 0;
332351
__int64u nDirCount = 0; //当前目录大小
333352
CHAR** ppListFile;
334-
SystemApi_File_EnumFile(stl_ListIterator->tszFilePath, &ppListFile, &nListCount, NULL, NULL, TRUE, 1);
353+
//处理路径是否有通配符
354+
TCHAR tszFilePath[MAX_PATH];
355+
memset(tszFilePath, '\0', MAX_PATH);
356+
357+
_tcscpy(tszFilePath, pSt_StorageBucket->tszFilePath);
358+
if (tszFilePath[_tcslen(tszFilePath) - 1] != '*')
359+
{
360+
int nPathType = 0;
361+
BaseLib_OperatorString_GetPath(tszFilePath, &nPathType);
362+
//判断是绝对路径还是相对路径
363+
if (1 == nPathType)
364+
{
365+
_tcscat(tszFilePath, _T("\\*"));
366+
}
367+
else if (2 == nPathType)
368+
{
369+
_tcscat(tszFilePath, _T("/*"));
370+
}
371+
}
372+
SystemApi_File_EnumFile(tszFilePath, &ppListFile, &nListCount, NULL, NULL, TRUE, 1);
335373
for (int j = 0; j < nListCount; j++)
336374
{
337375
struct _tstat64 st_FStat;

XEngine_Source/XEngine_StorageApp/Storage_APPTask/Storage_TaskManage.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,21 @@ BOOL XEngine_Task_Manage(LPCTSTR lpszAPIName, LPCTSTR lpszClientAddr, LPCTSTR lp
298298

299299
if (0 == nOPCode)
300300
{
301+
//处理路径格式
302+
if (tszRealDir[_tcslen(tszRealDir) - 1] != '*')
303+
{
304+
int nPathType = 0;
305+
BaseLib_OperatorString_GetPath(tszRealDir, &nPathType);
306+
//判断是绝对路径还是相对路径
307+
if (1 == nPathType)
308+
{
309+
_tcscat(tszRealDir, _T("\\*"));
310+
}
311+
else if (2 == nPathType)
312+
{
313+
_tcscat(tszRealDir, _T("/*"));
314+
}
315+
}
301316
if (!SystemApi_File_EnumFile(tszRealDir, &ppszListDir, &nListCount, NULL, NULL, TRUE, 2))
302317
{
303318
st_HDRParam.bIsClose = TRUE;

0 commit comments

Comments
 (0)