summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt2/GameList/GameFile.cpp
diff options
context:
space:
mode:
authorLeo Lam <leolino.lam@gmail.com>2017-08-22 21:29:30 +0200
committerGitHub <noreply@github.com>2017-08-22 21:29:30 +0200
commitb3a82098210e5ba0af2e12a4b8facccb7921dfad (patch)
treed7971c683ef50bb60faea1b97445d2e2972ba2e7 /Source/Core/DolphinQt2/GameList/GameFile.cpp
parent232b81999aaa85632799bcd7498f655a91e1c7bc (diff)
parent5f30ebed2303bfc1901c255d46996cc749be63c5 (diff)
Merge pull request #5960 from ligfx/gamefiledontstorefilepathparts
GameFile: don't store file path parts
Diffstat (limited to 'Source/Core/DolphinQt2/GameList/GameFile.cpp')
-rw-r--r--Source/Core/DolphinQt2/GameList/GameFile.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/Source/Core/DolphinQt2/GameList/GameFile.cpp b/Source/Core/DolphinQt2/GameList/GameFile.cpp
index 9e4e0f1dc2..c22b5e0ecf 100644
--- a/Source/Core/DolphinQt2/GameList/GameFile.cpp
+++ b/Source/Core/DolphinQt2/GameList/GameFile.cpp
@@ -5,6 +5,7 @@
#include <QCryptographicHash>
#include <QDataStream>
#include <QDir>
+#include <QFileInfo>
#include <QImage>
#include <QSharedPointer>
@@ -82,7 +83,7 @@ QString GameFile::GetCacheFileName() const
// files with the same names in different folders.
QString hash =
QString::fromUtf8(QCryptographicHash::hash(m_path.toUtf8(), QCryptographicHash::Md5).toHex());
- return folder + m_file_name + hash;
+ return folder + GetFileName() + hash;
}
void GameFile::ReadBanner(const DiscIO::Volume& volume)
@@ -107,9 +108,6 @@ bool GameFile::LoadFileInfo(const QString& path)
if (!info.exists() || !info.isReadable())
return false;
- m_file_name = info.fileName();
- m_extension = info.suffix();
- m_folder = info.dir().dirName();
m_last_modified = info.lastModified();
m_size = info.size();
@@ -127,7 +125,8 @@ void GameFile::LoadState()
bool GameFile::IsElfOrDol()
{
- return m_extension == QStringLiteral("elf") || m_extension == QStringLiteral("dol");
+ QString extension = GetFileExtension();
+ return extension == QStringLiteral("elf") || extension == QStringLiteral("dol");
}
bool GameFile::TryLoadCache()
@@ -205,6 +204,21 @@ void GameFile::SaveCache()
// TODO
}
+QString GameFile::GetFileName() const
+{
+ return QFileInfo(m_path).fileName();
+}
+
+QString GameFile::GetFileExtension() const
+{
+ return QFileInfo(m_path).suffix();
+}
+
+QString GameFile::GetFileFolder() const
+{
+ return QFileInfo(m_path).dir().dirName();
+}
+
QString GameFile::GetBannerString(const QMap<DiscIO::Language, QString>& m) const
{
// Try the settings language, then English, then just pick one.