From f5341a04386e2b34750301bbbdcced00ad6233dc Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 1 Apr 2003 19:31:55 +0000 Subject: [PATCH] fix paths that end in a slash --- stepmania/src/RageUtil.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 68e5fc9d1a..985566d810 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -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, * prepend "./" */ + /* Strip off the last path element and use it as a mask. */ unsigned pos = sPath.find_last_of("/\\"); - CString fn="*"; + CString fn; if(pos != sPath.npos) { fn = sPath.substr(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(); FDB.GetFilesSimpleMatch(sPath, fn, AddTo, bOnlyDirs);