diff options
author | B. Stack <bgstack15@gmail.com> | 2022-09-07 18:49:36 +0000 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-09-07 18:49:36 +0000 |
commit | 62bcefb8b809a32c6d26ab04ca686578bba5567a (patch) | |
tree | fbc1dea58a6b28f1af4a9e9b2bc8e3e1d23b2103 /zen/sys_info.cpp | |
parent | Merge branch 'b11.23' into 'master' (diff) | |
parent | add upstream 11.24 (diff) | |
download | FreeFileSync-62bcefb8b809a32c6d26ab04ca686578bba5567a.tar.gz FreeFileSync-62bcefb8b809a32c6d26ab04ca686578bba5567a.tar.bz2 FreeFileSync-62bcefb8b809a32c6d26ab04ca686578bba5567a.zip |
Merge branch 'b11.24' into 'master'11.24
add upstream 11.24
See merge request opensource-tracking/FreeFileSync!47
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: |