add volume widget

This commit is contained in:
2025-12-10 03:19:48 +01:00
parent a01bb7554b
commit 12546a36f8
8 changed files with 250 additions and 13 deletions

View File

@@ -1,7 +1,10 @@
#pragma once
#include <array>
#include <memory>
#include <string>
#include <fstream>
#include <sstream>
class SystemHelper
{
@@ -25,4 +28,18 @@ class SystemHelper
return result;
}
// Read an entire file into a string. Throws std::runtime_error on failure.
static std::string read_file_to_string(const std::string &path)
{
std::ifstream in(path, std::ios::in | std::ios::binary);
if (!in)
{
throw std::runtime_error("Failed to open file: " + path);
}
std::ostringstream ss;
ss << in.rdbuf();
return ss.str();
}
};