system: Turn on and off UID LED via netconf
Change-Id: Ic33a436f6bfb796379a019bd498b9919ce99a9d5
diff --git a/src/utils/io.cpp b/src/utils/io.cpp
index 4c84a89..5de62b2 100644
--- a/src/utils/io.cpp
+++ b/src/utils/io.cpp
@@ -78,6 +78,18 @@
return std::string(begin, end);
}
+void writeFile(const std::string& path, const std::string_view& contents)
+{
+ std::ofstream ofs(path);
+ if (!ofs.is_open()) {
+ throw std::invalid_argument("File '" + std::string(path) + "' could not be opened.");
+ }
+
+ if (!(ofs << contents)) {
+ throw std::invalid_argument("File '" + std::string(path) + "' could not be written.");
+ }
+}
+
void safeWriteFile(const std::string& filename, const std::string_view& contents)
{
auto throwErr = [&filename] (const auto& what) {