mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-29 23:03:18 +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) {
|
if (selected == openLogFolder) {
|
||||||
QString userPath;
|
QString logPath;
|
||||||
Common::FS::PathToQString(userPath,
|
Common::FS::PathToQString(logPath,
|
||||||
Common::FS::GetUserPath(Common::FS::PathType::UserDir));
|
Common::FS::GetUserPath(Common::FS::PathType::LogDir));
|
||||||
QDesktopServices::openUrl(QUrl::fromLocalFile(userPath + "/log"));
|
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) {
|
if (selected == &openSfoViewer) {
|
||||||
|
|
|
@ -855,6 +855,10 @@
|
||||||
<source>This game has no update folder to open!</source>
|
<source>This game has no update folder to open!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>No log file found for this game!</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Failed to convert icon.</source>
|
<source>Failed to convert icon.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue