mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 12:05:38 +00:00
Improved the %ROM% and %INJECT% variable logic and added support for Windows
This commit is contained in:
parent
ca65fcbe8c
commit
bdebe0133c
|
@ -1574,19 +1574,30 @@ void FileData::launchGame()
|
||||||
injectFile = Utils::String::replace(injectFile, "\\", "/");
|
injectFile = Utils::String::replace(injectFile, "\\", "/");
|
||||||
injectFile = Utils::String::replace(injectFile, "%BASENAME%",
|
injectFile = Utils::String::replace(injectFile, "%BASENAME%",
|
||||||
Utils::String::replace(baseName, "\"", ""));
|
Utils::String::replace(baseName, "\"", ""));
|
||||||
if (injectFile.size() < 3 || !(injectFile[1] == ':' && injectFile[2] == '/'))
|
if (injectFile == "%ROM%") {
|
||||||
injectFile =
|
injectFile = Utils::String::replace(injectFile, "%ROM%",
|
||||||
Utils::FileSystem::getParent(Utils::String::replace(romPath, "\"", "")) + "/" +
|
Utils::String::replace(romRaw, "\"", ""));
|
||||||
injectFile;
|
}
|
||||||
|
else {
|
||||||
|
if (injectFile.size() < 3 || !(injectFile[1] == ':' && injectFile[2] == '/'))
|
||||||
|
injectFile =
|
||||||
|
Utils::FileSystem::getParent(Utils::String::replace(romPath, "\"", "")) +
|
||||||
|
"/" + injectFile;
|
||||||
|
}
|
||||||
injectFile = Utils::String::replace(injectFile, "/", "\\");
|
injectFile = Utils::String::replace(injectFile, "/", "\\");
|
||||||
#else
|
#else
|
||||||
injectFile = Utils::String::replace(injectFile, "%BASENAME%",
|
injectFile = Utils::String::replace(injectFile, "%BASENAME%",
|
||||||
Utils::String::replace(baseName, "\\", ""));
|
Utils::String::replace(baseName, "\\", ""));
|
||||||
injectFile = Utils::String::replace(injectFile, "%ROM%", romRaw);
|
if (injectFile == "%ROM%") {
|
||||||
if (injectFile.front() != '/')
|
injectFile = Utils::String::replace(injectFile, "%ROM%",
|
||||||
injectFile =
|
Utils::String::replace(romRaw, "\\", ""));
|
||||||
Utils::FileSystem::getParent(Utils::String::replace(romPath, "\\", "")) + "/" +
|
}
|
||||||
injectFile;
|
else {
|
||||||
|
if (injectFile.front() != '/')
|
||||||
|
injectFile =
|
||||||
|
Utils::FileSystem::getParent(Utils::String::replace(romPath, "\\", "")) +
|
||||||
|
"/" + injectFile;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (Utils::FileSystem::isRegularFile(injectFile) ||
|
if (Utils::FileSystem::isRegularFile(injectFile) ||
|
||||||
Utils::FileSystem::isSymlink(injectFile)) {
|
Utils::FileSystem::isSymlink(injectFile)) {
|
||||||
|
|
Loading…
Reference in a new issue