[videodb] remove unused seasons table from episode_view
[xbmc.git] / xbmc / platform / linux / SysfsPath.cpp
blobaf4f9cb4011efef5fe7d824146aa362ce9232af7
1 /*
2 * Copyright (C) 2011-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #include "SysfsPath.h"
11 #include <exception>
13 bool CSysfsPath::Exists()
15 std::ifstream file(m_path);
17 if (!file.is_open())
18 return false;
20 return true;
23 template<>
24 std::optional<std::string> CSysfsPath::Get()
26 try
28 std::ifstream file(m_path);
30 std::string value;
32 std::getline(file, value);
34 if (file.bad())
36 CLog::LogF(LOGERROR, "error reading from '{}'", m_path);
37 return std::nullopt;
40 return value;
42 catch (const std::exception& e)
44 CLog::LogF(LOGERROR, "exception reading from '{}': {}", m_path, e.what());
45 return std::nullopt;