Rewrite FileSearch and improve ScanDirectoryTree.

- FileSearch is now just one function, and it converts the original glob
  into a regex on all platforms rather than relying on native Windows
  pattern matching on there and a complete hack elsewhere.  It now
  supports recursion out of the box rather than manually expanding
  into a full list of directories in multiple call sites.

  - This adds a GCC >= 4.9 dependency due to older versions having
  outright broken <regex>.  MSVC is fine with it.

- ScanDirectoryTree returns the parent entry rather than filling parts
  of it in via reference.  The count is now stored in the entry like it
  was for subdirectories.

- .glsl file search is now done with DoFileSearch.

- IOCTLV_READ_DIR now uses ScanDirectoryTree directly and sorts the
  results after replacements for better determinism.
This commit is contained in:
comex
2014-11-15 15:46:40 -05:00
parent 6ff3fcee59
commit a225426510
17 changed files with 156 additions and 348 deletions

View File

@ -67,9 +67,8 @@ void CWiiSaveCrypted::ExportAllSaves()
const u32 path_mask = 0x00010000;
for (int i = 0; i < 8; ++i)
{
File::FSTEntry fst_tmp;
std::string folder = StringFromFormat("%s/%08x/", title_folder.c_str(), path_mask | i);
File::ScanDirectoryTree(folder, fst_tmp);
File::FSTEntry fst_tmp = File::ScanDirectoryTree(folder, false);
for (const File::FSTEntry& entry : fst_tmp.children)
{
@ -627,8 +626,7 @@ void CWiiSaveCrypted::ScanForFiles(const std::string& save_directory, std::vecto
file_list.push_back(directories[i]);
}
File::FSTEntry fst_tmp;
File::ScanDirectoryTree(directories[i], fst_tmp);
File::FSTEntry fst_tmp = File::ScanDirectoryTree(directories[i], false);
for (const File::FSTEntry& elem : fst_tmp.children)
{
if (elem.virtualName != "banner.bin")