summaryrefslogtreecommitdiff
path: root/zen/sys_info.cpp
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-09-07 18:49:36 +0000
committerB. Stack <bgstack15@gmail.com>2022-09-07 18:49:36 +0000
commit62bcefb8b809a32c6d26ab04ca686578bba5567a (patch)
treefbc1dea58a6b28f1af4a9e9b2bc8e3e1d23b2103 /zen/sys_info.cpp
parentMerge branch 'b11.23' into 'master' (diff)
parentadd upstream 11.24 (diff)
downloadFreeFileSync-11.24.tar.gz
FreeFileSync-11.24.tar.bz2
FreeFileSync-11.24.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.cpp12
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:
bgstack15