diff options
author | B Stack <bgstack15@gmail.com> | 2020-03-18 08:59:09 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2020-03-18 08:59:09 -0400 |
commit | 2c4db439d235b68478d90c450289d2d0ba418547 (patch) | |
tree | 5c378aa54f4bb65c081cf9a92530d8af1f1f53dd /zen/system.cpp | |
parent | Merge branch '10.20' into 'master' (diff) | |
download | FreeFileSync-2c4db439d235b68478d90c450289d2d0ba418547.tar.gz FreeFileSync-2c4db439d235b68478d90c450289d2d0ba418547.tar.bz2 FreeFileSync-2c4db439d235b68478d90c450289d2d0ba418547.zip |
add upstream 10.21
Diffstat (limited to 'zen/system.cpp')
-rw-r--r-- | zen/system.cpp | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/zen/system.cpp b/zen/system.cpp index 5945484f..9401b94f 100644 --- a/zen/system.cpp +++ b/zen/system.cpp @@ -44,6 +44,7 @@ namespace ComputerModel zen::getComputerModel() //throw FileError { + ComputerModel cm; try { auto tryGetInfo = [](const Zstring& filePath) @@ -57,9 +58,33 @@ ComputerModel zen::getComputerModel() //throw FileError } catch (const FileError& e) { throw SysError(e.toString()); } //errors should be further enriched by context info => SysError }; - return { tryGetInfo("/sys/devices/virtual/dmi/id/product_name"), //throw SysError - tryGetInfo("/sys/devices/virtual/dmi/id/sys_vendor") }; // + cm.model = tryGetInfo("/sys/devices/virtual/dmi/id/product_name"); //throw SysError + cm.vendor = tryGetInfo("/sys/devices/virtual/dmi/id/sys_vendor"); // + + //clean up: + for (const char* dummyModel : + { + "To Be Filled By O.E.M.", "Default string", "empty", "O.E.M", "OEM", "NA", + "System Product Name", "Please change product name", "INVALID", + }) + if (equalAsciiNoCase(cm.model, dummyModel)) + { + cm.model.clear(); + break; + } + + for (const char* dummyVendor : + { + "To Be Filled By O.E.M.", "Default string", "empty", "O.E.M", "OEM", "NA", + "System manufacturer", "OEM Manufacturer", + }) + if (equalAsciiNoCase(cm.vendor, dummyVendor)) + { + cm.vendor.clear(); + break; + } + return cm; } catch (const SysError& e) { throw FileError(_("Cannot get process information."), e.toString()); } } @@ -73,7 +98,7 @@ std::wstring zen::getOsDescription() //throw FileError { const std::string osName = trimCpy(getCommandOutput("lsb_release --id -s" )); //throw SysError const std::string osVersion = trimCpy(getCommandOutput("lsb_release --release -s")); // - return utfTo<std::wstring>(osName + " " + osVersion); //e.g. "CentOS 7.7.1908" + return utfTo<std::wstring>(osName + ' ' + osVersion); //e.g. "CentOS 7.7.1908" } catch (const SysError& e) { throw FileError(_("Cannot get process information."), e.toString()); } |