Filesystem: Use file info in arguments instead of path

Some callers already have the file info, making the relatively slow
FindFileInfo calls unnecessary. Callers that didn't have the file info
will now need to call FindFileInfo on their own.
This commit is contained in:
JosJuice
2015-07-30 15:06:23 +02:00
parent 3d5ef948d0
commit 7c45afecb2
7 changed files with 53 additions and 39 deletions

View File

@ -405,12 +405,14 @@ void FilesystemPanel::ExtractSingleFile(const wxString& output_file_path) const
// Remove "Partition x/"
selection_file_path.erase(0, slash_index + 1);
partition->filesystem->ExportFile(WxStrToStr(selection_file_path),
WxStrToStr(output_file_path));
partition->filesystem->ExportFile(
partition->filesystem->FindFileInfo(WxStrToStr(selection_file_path)),
WxStrToStr(output_file_path));
}
else
{
m_filesystem->ExportFile(WxStrToStr(selection_file_path), WxStrToStr(output_file_path));
m_filesystem->ExportFile(m_filesystem->FindFileInfo(WxStrToStr(selection_file_path)),
WxStrToStr(output_file_path));
}
}
@ -456,6 +458,7 @@ void FilesystemPanel::ExtractDirectories(const std::string& full_path,
else
{
// Look for the dir we are going to extract
// TODO: Make this more efficient
for (index = 0; index < fst.size(); ++index)
{
if (filesystem->GetPathFromFSTOffset(index) == full_path)
@ -513,7 +516,7 @@ void FilesystemPanel::ExtractDirectories(const std::string& full_path,
StringFromFormat("%s/%s", output_folder.c_str(), path.c_str());
INFO_LOG(DISCIO, "%s", export_name.c_str());
if (!File::Exists(export_name) && !filesystem->ExportFile(path, export_name))
if (!File::Exists(export_name) && !filesystem->ExportFile(&fst[index], export_name))
{
ERROR_LOG(DISCIO, "Could not export %s", export_name.c_str());
}