mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-20 03:24:49 +00:00
'Select' the log when opening the folder if SeparateLogFiles (#2560)
* Select when opening log folder when getSeparateLogFilesEnabled * TR * +
This commit is contained in:
parent
6331eb1d8a
commit
75db253370
2 changed files with 52 additions and 4 deletions
|
@ -157,10 +157,54 @@ public:
|
|||
}
|
||||
|
||||
if (selected == openLogFolder) {
|
||||
QString userPath;
|
||||
Common::FS::PathToQString(userPath,
|
||||
Common::FS::GetUserPath(Common::FS::PathType::UserDir));
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(userPath + "/log"));
|
||||
QString logPath;
|
||||
Common::FS::PathToQString(logPath,
|
||||
Common::FS::GetUserPath(Common::FS::PathType::LogDir));
|
||||
if (!Config::getSeparateLogFilesEnabled()) {
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(logPath));
|
||||
} else {
|
||||
QString fileName = QString::fromStdString(m_games[itemID].serial) + ".log";
|
||||
QString filePath = logPath + "/" + fileName;
|
||||
QStringList arguments;
|
||||
if (QFile::exists(filePath)) {
|
||||
#ifdef Q_OS_WIN
|
||||
arguments << "/select," << filePath.replace("/", "\\");
|
||||
QProcess::startDetached("explorer", arguments);
|
||||
|
||||
#elif defined(Q_OS_MAC)
|
||||
arguments << "-R" << filePath;
|
||||
QProcess::startDetached("open", arguments);
|
||||
|
||||
#elif defined(Q_OS_LINUX)
|
||||
QStringList arguments;
|
||||
arguments << "--select" << filePath;
|
||||
if (!QProcess::startDetached("nautilus", arguments)) {
|
||||
// Failed to open Nautilus to select file
|
||||
arguments.clear();
|
||||
arguments << logPath;
|
||||
if (!QProcess::startDetached("xdg-open", arguments)) {
|
||||
// Failed to open directory on Linux
|
||||
}
|
||||
}
|
||||
#else
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(logPath));
|
||||
#endif
|
||||
} else {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setIcon(QMessageBox::Information);
|
||||
msgBox.setText(tr("No log file found for this game!"));
|
||||
|
||||
QPushButton* okButton = msgBox.addButton(QMessageBox::Ok);
|
||||
QPushButton* openFolderButton =
|
||||
msgBox.addButton(tr("Open Log Folder"), QMessageBox::ActionRole);
|
||||
|
||||
msgBox.exec();
|
||||
|
||||
if (msgBox.clickedButton() == openFolderButton) {
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(logPath));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selected == &openSfoViewer) {
|
||||
|
|
|
@ -855,6 +855,10 @@
|
|||
<source>This game has no update folder to open!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No log file found for this game!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to convert icon.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
|
Loading…
Add table
Reference in a new issue