Added a %GAMEENTRYDIR% variable to be used with the %STARTDIR% variable.

This commit is contained in:
Leon Styhre 2022-07-12 19:57:47 +02:00
parent d8df9cde43
commit 749f36fdfe

View file

@ -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;