Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move "game_data" to RW directory inside user folder for linux #252

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/file_format/trp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ bool TRP::Extract(std::filesystem::path trophyPath) {
return false;

s64 seekPos = sizeof(TrpHeader);
std::filesystem::path trpFilesPath(std::filesystem::current_path() / "game_data" /
std::filesystem::path trpFilesPath(std::filesystem::current_path() / "user/game_data" /
title / "TrophyFiles" / it.path().stem());
std::filesystem::create_directories(trpFilesPath / "Icons");
std::filesystem::create_directory(trpFilesPath / "Xml");
Expand Down Expand Up @@ -88,4 +88,4 @@ bool TRP::Extract(std::filesystem::path trophyPath) {
index++;
}
return true;
}
}
9 changes: 5 additions & 4 deletions src/qt_gui/game_grid_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,17 @@ void GameGridFrame::SetGridBackgroundImage(int row, int column) {
if (item) {
QString pic1Path = QString::fromStdString((*m_games_shared)[itemID].pic_path);
QString blurredPic1Path =
qApp->applicationDirPath() +
QString::fromStdString("/game_data/" + (*m_games_shared)[itemID].serial + "/pic1.png");
QDir::currentPath() +
QString::fromStdString("/user/game_data/" + (*m_games_shared)[itemID].serial +
"/pic1.png");

backgroundImage = QImage(blurredPic1Path);
if (backgroundImage.isNull()) {
QImage image(pic1Path);
backgroundImage = m_game_list_utils.BlurImage(image, image.rect(), 16);

std::filesystem::path img_path =
std::filesystem::path("game_data/") / (*m_games_shared)[itemID].serial;
std::filesystem::path("user/game_data/") / (*m_games_shared)[itemID].serial;
std::filesystem::create_directories(img_path);
if (!backgroundImage.save(blurredPic1Path, "PNG")) {
// qDebug() << "Error: Unable to save image.";
Expand All @@ -142,4 +143,4 @@ void GameGridFrame::RefreshGridBackgroundImage() {
palette.setColor(QPalette::Highlight, transparentColor);
this->setPalette(palette);
}
}
}
8 changes: 4 additions & 4 deletions src/qt_gui/game_list_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ void GameListFrame::SetListBackgroundImage(QTableWidgetItem* item) {

QString pic1Path = QString::fromStdString(m_game_info->m_games[item->row()].pic_path);
QString blurredPic1Path =
qApp->applicationDirPath() +
QString::fromStdString("/game_data/" + m_game_info->m_games[item->row()].serial +
QDir::currentPath() +
QString::fromStdString("/user/game_data/" + m_game_info->m_games[item->row()].serial +
"/pic1.png");

backgroundImage = QImage(blurredPic1Path);
Expand All @@ -109,7 +109,7 @@ void GameListFrame::SetListBackgroundImage(QTableWidgetItem* item) {
backgroundImage = m_game_list_utils.BlurImage(image, image.rect(), 16);

std::filesystem::path img_path =
std::filesystem::path("game_data/") / m_game_info->m_games[item->row()].serial;
std::filesystem::path("user/game_data/") / m_game_info->m_games[item->row()].serial;
std::filesystem::create_directories(img_path);
if (!backgroundImage.save(blurredPic1Path, "PNG")) {
// qDebug() << "Error: Unable to save image.";
Expand Down Expand Up @@ -206,4 +206,4 @@ void GameListFrame::SetRegionFlag(int row, int column, QString itemStr) {
widget->setLayout(layout);
this->setItem(row, column, item);
this->setCellWidget(row, column, widget);
}
}
2 changes: 1 addition & 1 deletion src/qt_gui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ int main(int argc, char* argv[]) {
// Load configurations and initialize Qt application
const auto config_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
Config::load(config_dir / "config.toml");
QString gameDataPath = qApp->applicationDirPath() + "/game_data/";
QString gameDataPath = QDir::currentPath() + "/user/game_data/";
std::string stdStr = gameDataPath.toStdString();
std::filesystem::path path(stdStr);
#ifdef _WIN64
Expand Down
4 changes: 2 additions & 2 deletions src/qt_gui/trophy_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ TrophyViewer::TrophyViewer(QString trophyPath, QString gameTrpPath) : QMainWindo
}

void TrophyViewer::PopulateTrophyWidget(QString title) {
QString trophyDir = qApp->applicationDirPath() + "/game_data/" + title + "/TrophyFiles";
QString trophyDir = QDir::currentPath() + "/user/game_data/" + title + "/TrophyFiles";
QDir dir(trophyDir);
if (!dir.exists()) {
std::filesystem::path path(gameTrpPath_.toStdString());
Expand Down Expand Up @@ -142,4 +142,4 @@ void TrophyViewer::SetTableItem(QTableWidget* parent, int row, int column, QStri
widget->setLayout(layout);
parent->setItem(row, column, item);
parent->setCellWidget(row, column, widget);
}
}