From 6c9c65323e04e5ef7574b32687eb57c8a85ef839 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Fri, 10 May 2019 13:38:12 +0200 Subject: [PATCH] Workaround for boost::filesystem and Visual Studio on Windows --- doc/15-troubleshooting.md | 2 +- lib/remote/configobjectutility.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/15-troubleshooting.md b/doc/15-troubleshooting.md index 6f4a965a9..bf12e9d6d 100644 --- a/doc/15-troubleshooting.md +++ b/doc/15-troubleshooting.md @@ -840,7 +840,7 @@ echo "dbe0bef8-c72c-4cc9-9779-da7c4527c5b2" > active-stage like this. Note: This is deep down in the code, use with care! ``` -sed -i 's/ActiveStages\["_api"\].*/ActiveStages\["_api"\] = "dbe0bef8-c72c-4cc9-9779-da7c4527c5b2"/g' /var/lib/icinga2/api/packages/_api/active.conf +sed -i 's/ActiveStages\["_api"\] = .*/ActiveStages\["_api"\] = "dbe0bef8-c72c-4cc9-9779-da7c4527c5b2"/g' /var/lib/icinga2/api/packages/_api/active.conf ``` Restart Icinga 2. diff --git a/lib/remote/configobjectutility.cpp b/lib/remote/configobjectutility.cpp index 9aeb30c06..6b83eb2cf 100644 --- a/lib/remote/configobjectutility.cpp +++ b/lib/remote/configobjectutility.cpp @@ -44,9 +44,12 @@ void ConfigObjectUtility::RepairPackage(const String& package) /* Try to fix the active stage, whenever we find a directory in there. * This automatically heals packages < 2.11 which remained broken. */ + String dir = ConfigPackageUtility::GetPackageDir() + "/" + package + "/"; + namespace fs = boost::filesystem; - fs::path path(ConfigPackageUtility::GetPackageDir() + "/" + package + "/"); + /* Use iterators to workaround VS builds on Windows. */ + fs::path path(dir.Begin(), dir.End()); fs::recursive_directory_iterator end; -- 2.40.0