Used whole path instead of relative path

This commit is contained in:
AlexApps99
2020-03-02 17:33:17 +13:00
parent 7408c388d6
commit 465e7c2521

View File

@ -5,6 +5,7 @@
#include "DolphinQt/GameList/GameListModel.h" #include "DolphinQt/GameList/GameListModel.h"
#include <QDir> #include <QDir>
#include <QFileInfo>
#include <QPixmap> #include <QPixmap>
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
@ -144,21 +145,10 @@ QVariant GameListModel::data(const QModelIndex& index, int role) const
case COL_FILE_PATH: case COL_FILE_PATH:
if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole) if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole)
{ {
QString file_path = QDir::cleanPath(QString::fromStdString(game.GetFilePath())); QString file_path = QFileInfo(QString::fromStdString(game.GetFilePath())).canonicalPath();
for (QString dir : Settings::Instance().GetPaths()) if (!file_path.endsWith(QDir::separator()))
{ file_path.append(QDir::separator());
dir = QDir::cleanPath(dir); return file_path;
if (file_path.startsWith(dir))
{
int path_index = dir.lastIndexOf(QLatin1Char('/'), -2);
if (path_index > -1)
{
file_path = file_path.mid(path_index + 1);
break;
}
}
}
return QDir::toNativeSeparators(file_path);
} }
break; break;
case COL_SIZE: case COL_SIZE: