From aa0fd6c3633e0718d47b4d513a7496a7fa86fb5d Mon Sep 17 00:00:00 2001 From: Malte Langkabel Date: Wed, 1 Jul 2026 22:40:45 +0200 Subject: [PATCH] Write replays next to the executable Place the "replays" folder in the executable's real directory (QCoreApplication::applicationDirPath()) instead of traversing up from the config dir with cdUp(). Relative traversal resolves incorrectly under a symlinked build layout (landing in bin rather than the build tree); using the exe's actual location avoids that. configDir is still passed for the config hash. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01DUsFgd2Ga6pmLz8giS8WUn --- src/ui/GameWorldView.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/ui/GameWorldView.cpp b/src/ui/GameWorldView.cpp index 8020246..0849a03 100644 --- a/src/ui/GameWorldView.cpp +++ b/src/ui/GameWorldView.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -162,13 +163,15 @@ GameWorldView::GameWorldView(Simulation* sim, const GameConfig* config, } else { - // Record every run to disk. Replays live under /replays, alongside - // the config dir that was loaded. Attaching the recorder opens the first - // file and writes the header for the initial run. - QDir replayDir(QString::fromStdString(configDir)); - replayDir.cdUp(); + // Record every run to disk, into a "replays" folder next to the executable. + // Uses the exe's real directory rather than traversing up from the config + // dir: with a symlinked build layout, relative traversal would resolve into + // the wrong tree. Attaching the recorder opens the first file and writes the + // header for the initial run. + const QString replayDir = + QDir(QCoreApplication::applicationDirPath()).filePath("replays"); m_commandManager.setRecorder(std::make_unique( - configDir, replayDir.filePath("replays").toStdString())); + configDir, replayDir.toStdString())); } }