Skip to content

Commit

Permalink
Common: Cleanup AssetReader extension filter.
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownbrackets committed May 10, 2021
1 parent 74a6524 commit 774b0e0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Common/File/FileUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ std::string GetFileExtension(const std::string & fn) {
if (pos == std::string::npos) {
return "";
}
std::string ext = fn.substr(pos + 1);
std::string ext = fn.substr(pos);
for (size_t i = 0; i < ext.size(); i++) {
ext[i] = tolower(ext[i]);
}
Expand Down
2 changes: 1 addition & 1 deletion Common/File/PathBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ std::vector<File::FileInfo> ApplyFilter(std::vector<File::FileInfo> files, const
auto pred = [&](const File::FileInfo &info) {
if (info.isDirectory || !filter)
return false;
std::string ext = "." + File::GetFileExtension(info.fullName);
std::string ext = File::GetFileExtension(info.fullName);
return filters.find(ext) == filters.end();
};
files.erase(std::remove_if(files.begin(), files.end(), pred), files.end());
Expand Down
4 changes: 2 additions & 2 deletions Common/File/VFS/AssetReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ bool ZipAssetReader::GetFileListing(const char *orig_path, std::vector<File::Fil
if (filter) {
while (*filter) {
if (*filter == ':') {
filters.insert(tmp);
filters.insert("." + tmp);
tmp = "";
} else {
tmp.push_back(*filter);
Expand All @@ -83,7 +83,7 @@ bool ZipAssetReader::GetFileListing(const char *orig_path, std::vector<File::Fil
}
}
if (tmp.size())
filters.insert(tmp);
filters.insert("." + tmp);

// We just loop through the whole ZIP file and deduce what files are in this directory, and what subdirectories there are.
std::set<std::string> files;
Expand Down
2 changes: 1 addition & 1 deletion Core/Loaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader) {
return IdentifiedFileType::ERROR_IDENTIFYING;
}

std::string extension = "." + File::GetFileExtension(fileLoader->GetPath());
std::string extension = File::GetFileExtension(fileLoader->GetPath());
if (extension == ".iso") {
// may be a psx iso, they have 2352 byte sectors. You never know what some people try to open
if ((fileLoader->FileSize() % 2352) == 0) {
Expand Down

0 comments on commit 774b0e0

Please sign in to comment.