diff options
author | B. Stack <bgstack15@gmail.com> | 2022-09-07 14:49:22 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-09-07 14:49:22 -0400 |
commit | 47c88c433d17948fab1d8e1d76121a72fe5938cb (patch) | |
tree | fbc1dea58a6b28f1af4a9e9b2bc8e3e1d23b2103 /zen/sys_info.cpp | |
parent | Merge branch 'b11.23' into 'master' (diff) | |
download | FreeFileSync-47c88c433d17948fab1d8e1d76121a72fe5938cb.tar.gz FreeFileSync-47c88c433d17948fab1d8e1d76121a72fe5938cb.tar.bz2 FreeFileSync-47c88c433d17948fab1d8e1d76121a72fe5938cb.zip |
add upstream 11.24
Diffstat (limited to 'zen/sys_info.cpp')
-rw-r--r-- | zen/sys_info.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/zen/sys_info.cpp b/zen/sys_info.cpp index bc1bfe62..c57464bc 100644 --- a/zen/sys_info.cpp +++ b/zen/sys_info.cpp @@ -111,16 +111,20 @@ ComputerModel zen::getComputerModel() //throw FileError { auto tryGetInfo = [](const Zstring& filePath) { - if (!fileAvailable(filePath)) - return std::wstring(); try { const std::string stream = getFileContent(filePath, nullptr /*notifyUnbufferedIO*/); //throw FileError return utfTo<std::wstring>(trimCpy(stream)); } - catch (const FileError& e) { throw SysError(replaceCpy(e.toString(), L"\n\n", L'\n')); } //errors should be further enriched by context info => SysError + catch (FileError&) + { + if (!itemStillExists(filePath)) //throw FileError + return std::wstring(); + + throw; + } }; - cm.model = tryGetInfo("/sys/devices/virtual/dmi/id/product_name"); //throw SysError + cm.model = tryGetInfo("/sys/devices/virtual/dmi/id/product_name"); //throw FileError cm.vendor = tryGetInfo("/sys/devices/virtual/dmi/id/sys_vendor"); // //clean up: |