Explorar o código

submission_package: Use std::string's rfind() when looking for the extension in InitializeExeFSAndRomFS()

When searching for a file extension, it's generally preferable to begin
the search at the end of the string rather than the beginning, as the
whole string isn't going to be walked just to check for something at the
end of it.
Lioncash %!s(int64=7) %!d(string=hai) anos
pai
achega
02841052aa
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/core/file_sys/submission_package.cpp

+ 1 - 1
src/core/file_sys/submission_package.cpp

@@ -207,7 +207,7 @@ void NSP::InitializeExeFSAndRomFS(const std::vector<VirtualFile>& files) {
     exefs = pfs;
 
     const auto romfs_iter = std::find_if(files.begin(), files.end(), [](const VirtualFile& file) {
-        return file->GetName().find(".romfs") != std::string::npos;
+        return file->GetName().rfind(".romfs") != std::string::npos;
     });
 
     if (romfs_iter == files.end()) {