mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2025-04-21 12:27:27 +03:00
The selector filters will now match also the files with an extension in uppercase.
Please note that the selector filters have to be entered in lowercase.
This commit is contained in:
@@ -80,12 +80,14 @@ void FileLister::browse()
|
|||||||
vector<string> vfilter;
|
vector<string> vfilter;
|
||||||
split(vfilter, getFilter(), ",");
|
split(vfilter, getFilter(), ",");
|
||||||
|
|
||||||
string filepath, file;
|
string filepath, file, file_lowercase;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
struct dirent *dptr;
|
struct dirent *dptr;
|
||||||
|
|
||||||
while ((dptr = readdir(dirp))) {
|
while ((dptr = readdir(dirp))) {
|
||||||
file = dptr->d_name;
|
file = dptr->d_name;
|
||||||
|
file_lowercase = file;
|
||||||
|
std::transform(file_lowercase.begin(), file_lowercase.end(), file_lowercase.begin(), ::tolower);
|
||||||
|
|
||||||
if (file[0] == '.' && file != "..")
|
if (file[0] == '.' && file != "..")
|
||||||
continue;
|
continue;
|
||||||
@@ -108,7 +110,7 @@ void FileLister::browse()
|
|||||||
continue;
|
continue;
|
||||||
for (vector<string>::iterator it = vfilter.begin(); it != vfilter.end(); ++it) {
|
for (vector<string>::iterator it = vfilter.begin(); it != vfilter.end(); ++it) {
|
||||||
if (it->length() <= file.length()) {
|
if (it->length() <= file.length()) {
|
||||||
if (file.compare(file.length() - it->length(), it->length(), *it) == 0) {
|
if (file_lowercase.compare(file.length() - it->length(), it->length(), *it) == 0) {
|
||||||
files.push_back(file);
|
files.push_back(file);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user