summaryrefslogtreecommitdiff
path: root/zen/sys_info.cpp
diff options
context:
space:
mode:
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