mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-03-06 14:27:43 +00:00
(Windows) Added a warning dialog on startup if an unsafe upgrade of the portable release has been made
This commit is contained in:
parent
66555101bf
commit
868c89cecf
|
@ -33,7 +33,6 @@
|
|||
#include "SystemData.h"
|
||||
#include "guis/GuiDetectDevice.h"
|
||||
#include "guis/GuiLaunchScreen.h"
|
||||
#include "guis/GuiMsgBox.h"
|
||||
#include "utils/FileSystemUtil.h"
|
||||
#include "utils/PlatformUtil.h"
|
||||
#include "utils/StringUtil.h"
|
||||
|
@ -825,6 +824,31 @@ int main(int argc, char* argv[])
|
|||
ViewController::getInstance()->updateAvailableDialog();
|
||||
#endif
|
||||
|
||||
#if defined(_WIN64)
|
||||
if (Settings::getInstance()->getBool("PortableMode")) {
|
||||
// If it's the portable Windows release then create a release file, and check if there
|
||||
// are any release files from different versions than the one currently running.
|
||||
// If this is the case an unsafe upgrade has taken place, probably by simply unpacking
|
||||
// the new release on top of the old one.
|
||||
bool releaseFileExists {true};
|
||||
const std::string releaseFile {"r" + std::to_string(PROGRAM_RELEASE_NUMBER) + ".rel"};
|
||||
if (!Utils::FileSystem::exists(Utils::FileSystem::getExePath() + "/" + releaseFile)) {
|
||||
releaseFileExists = Utils::FileSystem::createEmptyFile(
|
||||
Utils::FileSystem::getExePath() + "/" + releaseFile);
|
||||
}
|
||||
if (releaseFileExists) {
|
||||
for (auto& file : Utils::FileSystem::getMatchingFiles(
|
||||
Utils::FileSystem::getExePath() + "/*.rel")) {
|
||||
if (Utils::FileSystem::getFileName(file) != releaseFile) {
|
||||
LOG(LogWarning) << "It seems as if an unsafe upgrade has been made";
|
||||
ViewController::getInstance()->unsafeUpgradeDialog();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
LOG(LogInfo) << "Application startup time: "
|
||||
<< std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
std::chrono::system_clock::now() - applicationStartTime)
|
||||
|
|
|
@ -137,14 +137,29 @@ void ViewController::setMenuColors()
|
|||
}
|
||||
}
|
||||
|
||||
void ViewController::unsafeUpgradeDialog()
|
||||
{
|
||||
std::string upgradeMessage {"IT SEEMS AS IF AN UNSAFE UPGRADE HAS BEEN MADE, POSSIBLY BY "
|
||||
"UNPACKING THE NEW RELEASE ON TOP OF THE OLD ONE? THIS MAY CAUSE "
|
||||
"VARIOUS PROBLEMS, SOME OF WHICH MAY NOT BE APPARENT IMMEDIATELY. "
|
||||
"MAKE SURE TO ALWAYS FOLLOW THE UPGRADE INSTRUCTIONS IN THE "
|
||||
"README.TXT FILE THAT CAN BE FOUND IN THE EMULATIONSTATION-DE "
|
||||
"DIRECTORY."};
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
HelpStyle(), upgradeMessage.c_str(), "OK", [] {}, "", nullptr, "", nullptr, true, true,
|
||||
(mRenderer->getIsVerticalOrientation() ?
|
||||
0.85f :
|
||||
0.55f * (1.778f / mRenderer->getScreenAspectRatio()))));
|
||||
}
|
||||
|
||||
void ViewController::invalidSystemsFileDialog()
|
||||
{
|
||||
std::string errorMessage = "COULDN'T PARSE THE SYSTEMS CONFIGURATION FILE. "
|
||||
"IF YOU HAVE A CUSTOMIZED es_systems.xml FILE, THEN "
|
||||
"SOMETHING IS LIKELY WRONG WITH YOUR XML SYNTAX. "
|
||||
"IF YOU DON'T HAVE A CUSTOM SYSTEMS FILE, THEN THE "
|
||||
"EMULATIONSTATION INSTALLATION IS BROKEN. SEE THE "
|
||||
"APPLICATION LOG FILE es_log.txt FOR ADDITIONAL INFO";
|
||||
const std::string errorMessage {"COULDN'T PARSE THE SYSTEMS CONFIGURATION FILE. "
|
||||
"IF YOU HAVE A CUSTOMIZED es_systems.xml FILE, THEN "
|
||||
"SOMETHING IS LIKELY WRONG WITH YOUR XML SYNTAX. "
|
||||
"IF YOU DON'T HAVE A CUSTOM SYSTEMS FILE, THEN THE "
|
||||
"EMULATIONSTATION INSTALLATION IS BROKEN. SEE THE "
|
||||
"APPLICATION LOG FILE es_log.txt FOR ADDITIONAL INFO"};
|
||||
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
HelpStyle(), errorMessage.c_str(), "QUIT",
|
||||
|
|
|
@ -34,6 +34,7 @@ public:
|
|||
|
||||
// These functions are called from main().
|
||||
void setMenuColors();
|
||||
void unsafeUpgradeDialog();
|
||||
void invalidSystemsFileDialog();
|
||||
void noGamesDialog();
|
||||
void invalidAlternativeEmulatorDialog();
|
||||
|
|
Loading…
Reference in a new issue