summaryrefslogtreecommitdiff
path: root/src/helpers/fs/FsUtils.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2025-12-18 17:23:24 +0000
committerGitHub <noreply@github.com>2025-12-18 17:23:24 +0000
commit6175ecd4c4ba817c4620f66a75e1e11da7c7a8ca (patch)
treecf73852f1fc08b1dcee5a3a7380f914aaad9c50a /src/helpers/fs/FsUtils.cpp
parentf88deb928a0f7dc02f427473f8c29e8f2bed14a3 (diff)
debug: move to hyprutils' logger (#12673)
Diffstat (limited to 'src/helpers/fs/FsUtils.cpp')
-rw-r--r--src/helpers/fs/FsUtils.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/helpers/fs/FsUtils.cpp b/src/helpers/fs/FsUtils.cpp
index 0bc2e685..60af7d44 100644
--- a/src/helpers/fs/FsUtils.cpp
+++ b/src/helpers/fs/FsUtils.cpp
@@ -1,8 +1,9 @@
#include "FsUtils.hpp"
-#include "../../debug/Log.hpp"
+#include "../../debug/log/Logger.hpp"
#include <cstdlib>
#include <filesystem>
+#include <fstream>
#include <hyprutils/string/String.hpp>
#include <hyprutils/string/VarList.hpp>
@@ -17,7 +18,7 @@ std::optional<std::string> NFsUtils::getDataHome() {
const auto HOME = getenv("HOME");
if (!HOME) {
- Debug::log(ERR, "FsUtils::getDataHome: can't get data home: no $HOME or $XDG_DATA_HOME");
+ Log::logger->log(Log::ERR, "FsUtils::getDataHome: can't get data home: no $HOME or $XDG_DATA_HOME");
return std::nullopt;
}
@@ -27,26 +28,26 @@ std::optional<std::string> NFsUtils::getDataHome() {
std::error_code ec;
if (!std::filesystem::exists(dataRoot, ec) || ec) {
- Debug::log(ERR, "FsUtils::getDataHome: can't get data home: inaccessible / missing");
+ Log::logger->log(Log::ERR, "FsUtils::getDataHome: can't get data home: inaccessible / missing");
return std::nullopt;
}
dataRoot += "hyprland/";
if (!std::filesystem::exists(dataRoot, ec) || ec) {
- Debug::log(LOG, "FsUtils::getDataHome: no hyprland data home, creating.");
+ Log::logger->log(Log::DEBUG, "FsUtils::getDataHome: no hyprland data home, creating.");
std::filesystem::create_directory(dataRoot, ec);
if (ec) {
- Debug::log(ERR, "FsUtils::getDataHome: can't create new data home for hyprland");
+ Log::logger->log(Log::ERR, "FsUtils::getDataHome: can't create new data home for hyprland");
return std::nullopt;
}
std::filesystem::permissions(dataRoot, std::filesystem::perms::owner_read | std::filesystem::perms::owner_write | std::filesystem::perms::owner_exec, ec);
if (ec)
- Debug::log(WARN, "FsUtils::getDataHome: couldn't set perms on hyprland data store. Proceeding anyways.");
+ Log::logger->log(Log::WARN, "FsUtils::getDataHome: couldn't set perms on hyprland data store. Proceeding anyways.");
}
if (!std::filesystem::exists(dataRoot, ec) || ec) {
- Debug::log(ERR, "FsUtils::getDataHome: no hyprland data home, failed to create.");
+ Log::logger->log(Log::ERR, "FsUtils::getDataHome: no hyprland data home, failed to create.");
return std::nullopt;
}
@@ -69,7 +70,7 @@ std::optional<std::string> NFsUtils::readFileAsString(const std::string& path) {
bool NFsUtils::writeToFile(const std::string& path, const std::string& content) {
std::ofstream of(path, std::ios::trunc);
if (!of.good()) {
- Debug::log(ERR, "CVersionKeeperManager: couldn't open an ofstream for writing the version file.");
+ Log::logger->log(Log::ERR, "CVersionKeeperManager: couldn't open an ofstream for writing the version file.");
return false;
}