From 749f36fdfe6640d8dab308d673b5e96e2dea648b Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 12 Jul 2022 19:57:47 +0200 Subject: [PATCH] Added a %GAMEENTRYDIR% variable to be used with the %STARTDIR% variable. --- es-app/src/FileData.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/es-app/src/FileData.cpp b/es-app/src/FileData.cpp index 1572ebd29..dca55cd53 100644 --- a/es-app/src/FileData.cpp +++ b/es-app/src/FileData.cpp @@ -1264,6 +1264,9 @@ void FileData::launchGame() startDirectory = Utils::String::replace( startDirectory, "%GAMEDIR%", Utils::FileSystem::getParent(Utils::String::replace(romPath, "\"", ""))); + + startDirectory = Utils::String::replace(startDirectory, "%GAMEENTRYDIR%", + Utils::String::replace(romPath, "\"", "")); #else startDirectory = Utils::String::replace( startDirectory, "%EMUDIR%", @@ -1272,14 +1275,17 @@ void FileData::launchGame() startDirectory = Utils::String::replace( startDirectory, "%GAMEDIR%", Utils::FileSystem::getParent(Utils::String::replace(romPath, "\\", ""))); + + startDirectory = Utils::String::replace(startDirectory, "%GAMEENTRYDIR%", + Utils::String::replace(romPath, "\\", "")); #endif if (!Utils::FileSystem::isDirectory(startDirectory)) { Utils::FileSystem::createDirectory(startDirectory); if (!Utils::FileSystem::isDirectory(startDirectory)) { - LOG(LogError) - << "Couldn't launch game, directory defined by %STARTDIR% could not be " - "created, permission problems?"; + LOG(LogError) << "Couldn't launch game, directory \"" << startDirectory + << "\" defined by %STARTDIR% could not be created, " + "permission problems?"; LOG(LogError) << "Raw emulator launch command:"; LOG(LogError) << commandRaw;