From 77a0bae42f6c23bc323f59b79e5fac066680b8aa Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 26 Jun 2016 17:39:34 +0100 Subject: Load a default config file it one is present --- icespider/core/Jamfile.jam | 2 ++ icespider/core/core.cpp | 6 ++++++ icespider/core/core.h | 3 +++ 3 files changed, 11 insertions(+) diff --git a/icespider/core/Jamfile.jam b/icespider/core/Jamfile.jam index 5dbaf31..13ecc3d 100644 --- a/icespider/core/Jamfile.jam +++ b/icespider/core/Jamfile.jam @@ -1,6 +1,7 @@ lib adhocutil : : : : /usr/include/adhocutil ; lib slicer : : : : /usr/include/slicer ; lib boost_system ; +lib boost_filesystem ; lib icespider-core : [ glob-tree *.cpp : bin ] @@ -9,6 +10,7 @@ lib icespider-core : adhocutil slicer boost_system + boost_filesystem ../common : : . diff --git a/icespider/core/core.cpp b/icespider/core/core.cpp index 42aa7c7..3ada79c 100644 --- a/icespider/core/core.cpp +++ b/icespider/core/core.cpp @@ -1,7 +1,10 @@ #include "core.h" #include +#include namespace IceSpider { + const boost::filesystem::path Core::defaultConfig("config/ice.properties"); + Core::Core(int argc, char ** argv) { // Big enough to map all the request methods (an empty of zero lenght routes as default) @@ -18,6 +21,9 @@ namespace IceSpider { Ice::InitializationData id; id.properties = Ice::createProperties(argc, argv); + if (boost::filesystem::exists(defaultConfig)) { + id.properties->load(defaultConfig.string()); + } communicator = Ice::initialize(id); } diff --git a/icespider/core/core.h b/icespider/core/core.h index a6c42f6..238f4ae 100644 --- a/icespider/core/core.h +++ b/icespider/core/core.h @@ -5,6 +5,7 @@ #include #include "irouteHandler.h" #include +#include namespace IceSpider { class DLL_PUBLIC Core { @@ -23,6 +24,8 @@ namespace IceSpider { MethodRoutes routes; Ice::CommunicatorPtr communicator; + + static const boost::filesystem::path defaultConfig; }; } -- cgit v1.2.3