1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 19:57:45 +00:00

Make open game dir button work on Windows

This commit is contained in:
redstrate 2021-11-02 08:27:11 -04:00
parent b8893ee0b0
commit 07fff42a00

View file

@ -84,7 +84,14 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window
auto gameDirectoryButton = new QPushButton("Open Game Directory");
connect(gameDirectoryButton, &QPushButton::pressed, [this] {
#if defined(Q_OS_WIN)
// for some reason, windows requires special treatment (what else is new?)
const QFileInfo fileInfo(this->window.gamePath);
QProcess::startDetached("explorer.exe", QStringList(QDir::toNativeSeparators(fileInfo.canonicalFilePath())));
#else
QDesktopServices::openUrl("file://" + this->window.gamePath);
#endif
});
layout->addWidget(gameDirectoryButton);
}