From 92a901c07406582b1d823ee1150c749cd9e4212d Mon Sep 17 00:00:00 2001 From: SulfurNitride Date: Sun, 29 Mar 2026 01:21:51 -0500 Subject: Block game launch when no Wine prefix is configured MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of logging a warning and attempting to launch (which fails with EACCES), show a clear error dialog directing the user to Settings → Wine/Proton to create a prefix. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/src/spawn.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/src/spawn.cpp b/src/src/spawn.cpp index 4a4d32b..d94fbae 100644 --- a/src/src/spawn.cpp +++ b/src/src/spawn.cpp @@ -663,13 +663,15 @@ int spawn(const SpawnParameters &sp, pid_t &processId) { const QString prefixPath = resolvePrefixPath(); if (prefixPath.isEmpty()) { - MOBase::log::warn( - "No Wine prefix configured - games may not launch correctly. " - "Configure a prefix in Settings > Proton or via fluorine-manager."); + MOBase::log::error( + "No Wine prefix configured - cannot launch game. " + "Configure a prefix in Settings > Proton."); + return ENOENT; } else if (!QDir(QDir(prefixPath).filePath("drive_c")).exists()) { - MOBase::log::warn( - "Wine prefix '{}' does not contain drive_c/ - prefix may be invalid", + MOBase::log::error( + "Wine prefix '{}' does not contain drive_c/ - prefix is invalid", prefixPath); + return ENOENT; } else { MOBase::log::info("Using Wine prefix: {}", prefixPath); launcher.setPrefix(prefixPath); @@ -1024,7 +1026,19 @@ pid_t startBinary(QWidget *parent, const SpawnParameters &sp) { const auto e = spawn::spawn(sp, pid); if (e != 0) { - dialogs::spawnFailed(parent, sp, e); + if (e == ENOENT && sp.useProton) { + QMessageBox::critical( + parent, QObject::tr("No Wine Prefix"), + QObject::tr("No Wine prefix has been configured for this instance.\n\n" + "A Wine prefix is required to run Windows games through " + "Proton.\n\n" + "To create one, go to:\n" + " Settings \u2192 Wine/Proton\n\n" + "Set the prefix location, then click \"Create Prefix\" " + "to generate a new prefix.")); + } else { + dialogs::spawnFailed(parent, sp, e); + } return -1; } -- cgit v1.3.1