From 745641c8e2bdde4ae7a6f0abd2ac806101ae77ea Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Fri, 5 Jul 2024 12:22:44 +0200 Subject: [PATCH] Fix for Windows compilation. --- src/core/logger.cc | 3 ++- src/util/filesystem.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/logger.cc b/src/core/logger.cc index 07a537b..0681957 100644 --- a/src/core/logger.cc +++ b/src/core/logger.cc @@ -4,6 +4,7 @@ #include "autogen/config.h" #include "core/configuration.h" +#include "util/filesystem.h" #include #include @@ -65,7 +66,7 @@ Result zeek::agent::setGlobalLogger(options::LogType type, options::Log if ( ! path ) return result::Error("file logging requires a path"); - sink = std::make_shared(path->string()); + sink = std::make_shared(path_to_spdlog_filename(*path)); break; } diff --git a/src/util/filesystem.h b/src/util/filesystem.h index 1e29b31..3c85ae8 100644 --- a/src/util/filesystem.h +++ b/src/util/filesystem.h @@ -7,6 +7,7 @@ #include #include +#include /** Type alias. */ namespace filesystem = ghc::filesystem; @@ -18,8 +19,10 @@ namespace platform::windows { std::string narrowWstring(const std::wstring& wstr); // provided by platform.cc } // namespace platform::windows inline std::string path_to_string(const filesystem::path& p) { return platform::windows::narrowWstring(p.native()); } +inline spdlog::filename_t path_to_spdlog_filename(const filesystem::path& p) { return p.wstring(); } #else inline std::string path_to_string(const filesystem::path& p) { return p.native(); } +inline spdlog::filename_t path_to_spdlog_filename(const filesystem::path& p) { return p.string(); } #endif } // namespace zeek::agent