Просмотр исходного кода

registered_cache: Make use of ends_with for string suffix checking

Simplifies code.
Lioncash 5 лет назад
Родитель
Сommit
67a8e73101
1 измененных файлов с 1 добавлено и 2 удалено
  1. 1 2
      src/core/file_sys/registered_cache.cpp

+ 1 - 2
src/core/file_sys/registered_cache.cpp

@@ -257,8 +257,7 @@ std::vector<NcaID> PlaceholderCache::List() const {
     for (const auto& sdir : dir->GetSubdirectories()) {
         for (const auto& file : sdir->GetFiles()) {
             const auto name = file->GetName();
-            if (name.length() == 36 && name[32] == '.' && name[33] == 'n' && name[34] == 'c' &&
-                name[35] == 'a') {
+            if (name.length() == 36 && name.ends_with(".nca")) {
                 out.push_back(Common::HexStringToArray<0x10>(name.substr(0, 32)));
             }
         }