fix paths that end in a slash
This commit is contained in:
@@ -1234,14 +1234,20 @@ void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs, bool bRe
|
|||||||
* correct (we need a place to start from); so if sPath is relative,
|
* correct (we need a place to start from); so if sPath is relative,
|
||||||
* prepend "./" */
|
* prepend "./" */
|
||||||
|
|
||||||
|
/* Strip off the last path element and use it as a mask. */
|
||||||
unsigned pos = sPath.find_last_of("/\\");
|
unsigned pos = sPath.find_last_of("/\\");
|
||||||
CString fn="*";
|
CString fn;
|
||||||
if(pos != sPath.npos)
|
if(pos != sPath.npos)
|
||||||
{
|
{
|
||||||
fn = sPath.substr(pos+1);
|
fn = sPath.substr(pos+1);
|
||||||
sPath = sPath.substr(0, pos+1);
|
sPath = sPath.substr(0, pos+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If there was only one path element, or if the last element was empty,
|
||||||
|
* use "*". */
|
||||||
|
if(fn.size() == 0)
|
||||||
|
fn = "*";
|
||||||
|
|
||||||
unsigned start = AddTo.size();
|
unsigned start = AddTo.size();
|
||||||
FDB.GetFilesSimpleMatch(sPath, fn, AddTo, bOnlyDirs);
|
FDB.GetFilesSimpleMatch(sPath, fn, AddTo, bOnlyDirs);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user