mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Common: Fix dir listing extension filter.
Oops. Also correct std::move() usage, which assumed it cleared the source string.
This commit is contained in:
parent
b3ce171523
commit
36549a960f
@ -130,6 +130,7 @@ size_t GetFilesInDir(const char *directory, std::vector<FileInfo> * files, const
|
||||
while (*filter) {
|
||||
if (*filter == ':') {
|
||||
filters.insert(std::move(tmp));
|
||||
tmp.clear();
|
||||
} else {
|
||||
tmp.push_back(*filter);
|
||||
}
|
||||
@ -196,9 +197,11 @@ size_t GetFilesInDir(const char *directory, std::vector<FileInfo> * files, const
|
||||
info.isWritable = false; // TODO - implement some kind of check
|
||||
if (!info.isDirectory) {
|
||||
std::string ext = GetFileExtension(info.fullName);
|
||||
if (filter) {
|
||||
if (filters.find(ext) == filters.end())
|
||||
if (!ext.empty()) {
|
||||
ext = ext.substr(1); // Remove the dot.
|
||||
if (filter && filters.find(ext) == filters.end()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,7 @@ std::vector<File::FileInfo> ApplyFilter(std::vector<File::FileInfo> files, const
|
||||
while (*filter) {
|
||||
if (*filter == ':') {
|
||||
filters.insert("." + tmp);
|
||||
tmp.clear();
|
||||
} else {
|
||||
tmp.push_back(*filter);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ bool ZipAssetReader::GetFileListing(const char *orig_path, std::vector<File::Fil
|
||||
while (*filter) {
|
||||
if (*filter == ':') {
|
||||
filters.insert("." + tmp);
|
||||
tmp = "";
|
||||
tmp.clear();
|
||||
} else {
|
||||
tmp.push_back(*filter);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user