summaryrefslogtreecommitdiff
path: root/zen/sys_version.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zen/sys_version.cpp')
-rw-r--r--zen/sys_version.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/zen/sys_version.cpp b/zen/sys_version.cpp
index 46918315..d07bbc33 100644
--- a/zen/sys_version.cpp
+++ b/zen/sys_version.cpp
@@ -78,14 +78,17 @@ OsVersionDetail zen::getOsVersionDetail() //throw SysError
OsVersion zen::getOsVersion()
{
- try
- {
- static const OsVersionDetail verDetail = getOsVersionDetail(); //throw SysError
- return verDetail.version;
- }
- catch (const SysError& e)
+ static const OsVersionDetail verDetail = []
{
- std::cerr << utfTo<std::string>(e.toString()) << '\n';
- return {}; //sigh, it's a jungle out there: https://freefilesync.org/forum/viewtopic.php?t=7276
- }
+ try
+ {
+ return getOsVersionDetail(); //throw SysError
+ }
+ catch (const SysError& e)
+ {
+ std::cerr << utfTo<std::string>(e.toString()) << '\n';
+ return OsVersionDetail{}; //sigh, it's a jungle out there: https://freefilesync.org/forum/viewtopic.php?t=7276
+ }
+ }();
+ return verDetail.version;
}
bgstack15