[PVR][Estuary] Timer settings dialog: Show client name in timer type selection dialog...
[xbmc.git] / xbmc / platform / linux / SysfsPath.h
blob72c7fe017ebef3c6b9c6c967830063514a407c4d
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 #pragma once
11 #include "utils/log.h"
13 #include <fstream>
14 #include <string>
16 class CSysfsPath
18 public:
19 CSysfsPath() = default;
20 CSysfsPath(const std::string& path) : m_path(path) {}
21 ~CSysfsPath() = default;
23 bool Exists();
25 template<typename T>
26 T Get()
28 std::ifstream file(m_path);
30 T value;
32 file >> value;
34 if (file.bad())
36 CLog::LogF(LOGERROR, "error reading from '{}'", m_path);
37 throw std::runtime_error("error reading from " + m_path);
40 return value;
43 private:
44 std::string m_path;
47 template<>
48 std::string CSysfsPath::Get<std::string>();