mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 08:22:32 +00:00
Select when opening log folder when getSeparateLogFilesEnabled
This commit is contained in:
parent
63b50ff92c
commit
f1eae0c623
@ -155,10 +155,43 @@ 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::information(nullptr, tr("Error"),
|
||||||
|
QString(tr("No log file found for this game!")));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected == &openSfoViewer) {
|
if (selected == &openSfoViewer) {
|
||||||
|
Loading…
Reference in New Issue
Block a user