2
0
mirror of https://github.com/Thracky/GlosSI.git synced 2024-11-15 06:12:54 +00:00

SteamTarget: cd to program-dir before launching program

This commit is contained in:
Peter Repukat 2018-04-15 15:45:55 +02:00
parent aa4c9a91b6
commit 294d9234c1

View File

@ -214,10 +214,15 @@ void SteamTarget::launchApplication()
{
// To get our launched application not get hooked by Steam, we have to launch through Windows explorer
// To use arguments, launching using explorer, we have to use a batch file...
const QString batchContents = '\"' + QDir::toNativeSeparators(QString::fromStdString(launch_app_path_))
QString programPath = QDir::toNativeSeparators(QString::fromStdString(launch_app_path_));
programPath = programPath.mid(0, programPath.lastIndexOf("\\"));
const QString batchContents =
"cd \"" + programPath + "\"\n"
+ '\"' + QDir::toNativeSeparators(QString::fromStdString(launch_app_path_))
+ '\"' + " " + QString::fromStdString(launch_app_args_);
QFile file("launchApp.bat");
QFile file(QString(QStandardPaths::standardLocations(QStandardPaths::AppDataLocation).at(0) + "/launchApp.bat"));
if (file.open(QIODevice::ReadWrite | QIODevice::Text | QIODevice::Truncate)) {
QTextStream stream(&file);