summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2017-06-29 11:20:38 +0200
committerJosJuice <josjuice@gmail.com>2017-06-29 19:07:29 +0200
commit5ca3aee00ac3ac1a906de68c216907a7b41825fe (patch)
treee2d174e4120f525d85d29296fdfe4b89c69883cb /Source/Core/VideoCommon/TextureCacheBase.cpp
parente14a82a87ee1b3d32a13736a0224b8247f6195f4 (diff)
FileUtil: Add a class for Exists/IsDirectory/GetSize
Some code was calling more than one of these functions in a row (in particular, FileUtil.cpp itself did it a lot...), which is a waste since it's possible to call stat a single time and then read all three values from the stat struct. This commit adds a File::FileInfo class that calls stat once on construction and then lets Exists/IsDirectory/GetSize be executed very quickly. The performance improvement mostly matters for functions that can be handling a lot of files, such as File::ScanDirectoryTree. I've also done some cleanup in code that uses these functions. For instance, some code had checks like !Exists() || !IsDirectory(), which is functionally equivalent to !IsDirectory(), and some code was using File::GetSize even though there was an IOFile object that the code could call GetSize on.
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index c61fa1fe5e..5c7c61695a 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -424,7 +424,7 @@ void TextureCacheBase::DumpTexture(TCacheEntry* entry, std::string basename, uns
std::string szDir = File::GetUserPath(D_DUMPTEXTURES_IDX) + SConfig::GetInstance().GetGameID();
// make sure that the directory exists
- if (!File::Exists(szDir) || !File::IsDirectory(szDir))
+ if (!File::IsDirectory(szDir))
File::CreateDir(szDir);
if (level > 0)