cwFileSys.cpp: Automatically expandPath() in dirEntries().

This commit is contained in:
kevin 2021-08-15 15:47:04 -04:00
parent ddad22cde0
commit f8e0a24032

View File

@ -713,19 +713,20 @@ namespace cw
cw::filesys::dirEntry_t* cw::filesys::dirEntries( const char* dirStr, unsigned filterFlags, unsigned* dirEntryCntPtr ) cw::filesys::dirEntry_t* cw::filesys::dirEntries( const char* dirStr, unsigned filterFlags, unsigned* dirEntryCntPtr )
{ {
rc_t rc = kOkRC; rc_t rc = kOkRC;
deRecd_t r; deRecd_t r;
memset(&r,0,sizeof(r)); memset(&r,0,sizeof(r));
//r.p = _cmFileSysHandleToPtr(h);
r.filterFlags = filterFlags; r.filterFlags = filterFlags;
cwAssert( dirEntryCntPtr != NULL ); cwAssert( dirEntryCntPtr != NULL );
*dirEntryCntPtr = 0; *dirEntryCntPtr = 0;
char* inDirStr = filesys::expandPath(dirStr);
for(r.passIdx=0; r.passIdx<2; ++r.passIdx) for(r.passIdx=0; r.passIdx<2; ++r.passIdx)
{ {
if((rc = _dirGetEntries( &r, dirStr )) != kOkRC ) if((rc = _dirGetEntries( &r, inDirStr )) != kOkRC )
goto errLabel; goto errLabel;
if( r.passIdx == 0 && r.dataByteCnt>0 ) if( r.passIdx == 0 && r.dataByteCnt>0 )
@ -757,6 +758,8 @@ cw::filesys::dirEntry_t* cw::filesys::dirEntries( const char* dirStr, unsigned f
r.rp = NULL; r.rp = NULL;
} }
mem::release(inDirStr);
return r.rp; return r.rp;
} }