mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-29 01:25:38 +00:00
Trying to fix the version not showing correctly -fix2
This commit is contained in:
parent
a0abe7c7b9
commit
8f5e052c9e
|
@ -2330,6 +2330,18 @@ void GuiMenu::addVersionInfo()
|
||||||
mVersion.setColor(mMenuColorTertiary);
|
mVersion.setColor(mMenuColorTertiary);
|
||||||
|
|
||||||
const std::string applicationName {"RetroDECK"};
|
const std::string applicationName {"RetroDECK"};
|
||||||
|
std::ifstream file("/app/retrodeck/version");
|
||||||
|
std::string version;
|
||||||
|
if (file.is_open() && std::getline(file, version) && !version.empty()) {
|
||||||
|
file.close();
|
||||||
|
#undef PROGRAM_VERSION_STRING
|
||||||
|
#define PROGRAM_VERSION_STRING version.c_str()
|
||||||
|
std::cout << "Version read from file: " << PROGRAM_VERSION_STRING << std::endl;
|
||||||
|
} else {
|
||||||
|
std::cerr << "Error: Cannot read version from file or file is empty!" << std::endl;
|
||||||
|
// Set a default value in case the file can't be read
|
||||||
|
#define PROGRAM_VERSION_STRING "UNKNOWN"
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(IS_PRERELEASE)
|
#if defined(IS_PRERELEASE)
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
|
@ -2344,19 +2356,9 @@ void GuiMenu::addVersionInfo()
|
||||||
mVersion.setText(applicationName + " " + Utils::String::toUpper(PROGRAM_VERSION_STRING) + "-" +
|
mVersion.setText(applicationName + " " + Utils::String::toUpper(PROGRAM_VERSION_STRING) + "-" +
|
||||||
std::to_string(ANDROID_VERSION_CODE));
|
std::to_string(ANDROID_VERSION_CODE));
|
||||||
#else
|
#else
|
||||||
std::ifstream file("/app/retrodeck/version");
|
|
||||||
std::string version;
|
|
||||||
std::getline(file, version);
|
|
||||||
file.close();
|
|
||||||
#undef PROGRAM_VERSION_STRING
|
|
||||||
#define PROGRAM_VERSION_STRING version.c_str()
|
|
||||||
std::cout << PROGRAM_VERSION_STRING << std::endl;
|
|
||||||
mVersion.setText(applicationName + " " + Utils::String::toUpper(PROGRAM_VERSION_STRING));
|
mVersion.setText(applicationName + " " + Utils::String::toUpper(PROGRAM_VERSION_STRING));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mVersion.setHorizontalAlignment(ALIGN_CENTER);
|
|
||||||
addChild(&mVersion);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiMenu::openThemeDownloader(GuiSettings* settings)
|
void GuiMenu::openThemeDownloader(GuiSettings* settings)
|
||||||
|
|
Loading…
Reference in a new issue