summaryrefslogtreecommitdiff
path: root/quacker
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2025-08-25 09:51:49 -0400
committerpommicket <pommicket@gmail.com>2025-08-25 09:51:49 -0400
commitbc2493805b464e138b65bd48855682cedcfb9275 (patch)
treee34e5cad850f9e0a9a06c26fcce46cea17d61a29 /quacker
parent51484c674e01000c20fc150f5bcb10f30a480c73 (diff)
Try using full path for GCG
Diffstat (limited to 'quacker')
-rw-r--r--quacker/macondobackend.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/quacker/macondobackend.cpp b/quacker/macondobackend.cpp
index ef1b6dd..2fc0df2 100644
--- a/quacker/macondobackend.cpp
+++ b/quacker/macondobackend.cpp
@@ -10,6 +10,7 @@
#include <QTimer>
#include <QTextStream>
#include <QThread>
+#include <QCoreApplication>
#include <random>
#include <climits>
@@ -115,7 +116,7 @@ bool MacondoBackend::startProcess(Command command) {
QStringList args;
connect(m_process, SIGNAL(started()), this, SLOT(processStarted()));
connect(m_process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished(int, QProcess::ExitStatus)));
- m_process->start(m_execPath.c_str(), args, QIODevice::Unbuffered | QIODevice::Text | QIODevice::ReadWrite);
+ m_process->start(m_execPath.c_str(), args, QIODevice::Text | QIODevice::ReadWrite);
return true;
}
@@ -654,8 +655,8 @@ void MacondoBackend::loadGCG() {
std::uniform_int_distribution<int> distribution(0, 25);
removeTempGCG();
// save game file with random name
- char filename[] = "tmpGameXXXXXXXXXXXX.gcg";
- for (int i = 0; filename[i]; i++) {
+ std::string filename = (QCoreApplication::applicationDirPath() + "/tmpGameXXXXXXXXXXXX.gcg").toStdString();
+ for (size_t i = 0; i < filename.length(); i++) {
if (filename[i] == 'X') {
filename[i] = distribution(rand) + 'A';
}
@@ -663,14 +664,14 @@ void MacondoBackend::loadGCG() {
m_tempGCG = filename;
QuackleIO::GCGIO gcg;
{
- QFile file(filename);
+ QFile file(filename.c_str());
file.open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream fileStream(&file);
gcg.write(*m_game, fileStream);
}
std::stringstream commands;
commands << "set lexicon " << lexicon << "\n"
- << "load " << filename << "\n"
+ << "load '" << filename << "'\n"
<< "turn " << getPlyNumber(m_game->currentPosition()) << "\n";
send(commands.str().c_str());
}