mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
Merge pull request #5960 from ligfx/gamefiledontstorefilepathparts
GameFile: don't store file path parts
This commit is contained in:
commit
b3a8209821
@ -5,6 +5,7 @@
|
|||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QFileInfo>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
|
||||||
@ -82,7 +83,7 @@ QString GameFile::GetCacheFileName() const
|
|||||||
// files with the same names in different folders.
|
// files with the same names in different folders.
|
||||||
QString hash =
|
QString hash =
|
||||||
QString::fromUtf8(QCryptographicHash::hash(m_path.toUtf8(), QCryptographicHash::Md5).toHex());
|
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)
|
void GameFile::ReadBanner(const DiscIO::Volume& volume)
|
||||||
@ -107,9 +108,6 @@ bool GameFile::LoadFileInfo(const QString& path)
|
|||||||
if (!info.exists() || !info.isReadable())
|
if (!info.exists() || !info.isReadable())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_file_name = info.fileName();
|
|
||||||
m_extension = info.suffix();
|
|
||||||
m_folder = info.dir().dirName();
|
|
||||||
m_last_modified = info.lastModified();
|
m_last_modified = info.lastModified();
|
||||||
m_size = info.size();
|
m_size = info.size();
|
||||||
|
|
||||||
@ -127,7 +125,8 @@ void GameFile::LoadState()
|
|||||||
|
|
||||||
bool GameFile::IsElfOrDol()
|
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()
|
bool GameFile::TryLoadCache()
|
||||||
@ -205,6 +204,21 @@ void GameFile::SaveCache()
|
|||||||
// TODO
|
// 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
|
QString GameFile::GetBannerString(const QMap<DiscIO::Language, QString>& m) const
|
||||||
{
|
{
|
||||||
// Try the settings language, then English, then just pick one.
|
// Try the settings language, then English, then just pick one.
|
||||||
|
@ -30,9 +30,9 @@ public:
|
|||||||
bool IsValid() const;
|
bool IsValid() const;
|
||||||
// These will be properly initialized before we try to load the file.
|
// These will be properly initialized before we try to load the file.
|
||||||
QString GetFilePath() const { return m_path; }
|
QString GetFilePath() const { return m_path; }
|
||||||
QString GetFileName() const { return m_file_name; }
|
QString GetFileName() const;
|
||||||
QString GetFileExtension() const { return m_extension; }
|
QString GetFileExtension() const;
|
||||||
QString GetFileFolder() const { return m_folder; }
|
QString GetFileFolder() const;
|
||||||
qint64 GetFileSize() const { return m_size; }
|
qint64 GetFileSize() const { return m_size; }
|
||||||
// The rest will not.
|
// The rest will not.
|
||||||
QString GetGameID() const { return m_game_id; }
|
QString GetGameID() const { return m_game_id; }
|
||||||
@ -88,9 +88,6 @@ private:
|
|||||||
|
|
||||||
bool m_valid;
|
bool m_valid;
|
||||||
QString m_path;
|
QString m_path;
|
||||||
QString m_file_name;
|
|
||||||
QString m_extension;
|
|
||||||
QString m_folder;
|
|
||||||
QDateTime m_last_modified;
|
QDateTime m_last_modified;
|
||||||
qint64 m_size = 0;
|
qint64 m_size = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user