int Config::load_config_from_files(string config_path)
{
+ fs::path full_config_path = fs::system_complete(fs::path(config_path));
+
+ if( fs::exists(full_config_path) && fs::is_directory(full_config_path))
+ {
+ fs::directory_iterator end_iter;
+ for(fs::directory_iterator dir_itr(full_config_path); dir_itr != end_iter; ++dir_itr)
+ {
+ if( fs::is_regular_file(dir_itr->status()))
+ {
+ string filename = dir_itr->path().filename();
+ if(filename == "bpdyndnsd.conf")
+ {
+ cout << filename << endl;
+ }
+ }
+ }
+
+ }
+ else
+ {
+ cout << "Path doesn't exist or is not a directory" << endl;
+ return 4;
+ }
+
+
+
+
+
+
+/*
+
// first load the main config file bpdyndnsd.conf
string main_conf_file = config_path.append("/bpdyndnsd.conf");
ifstream config_file (main_conf_file.c_str(),ifstream::in);
cout << "Can't open main config file for reading: " << main_conf_file << endl;
return 4;
}
-
+*/
// then load all service definition files in config path
// TODO: code to load service definition files in config path
+ return -1;
}
#include <boost/program_options.hpp>
#include <boost/foreach.hpp>
+#include <boost/filesystem.hpp>
+
#include <string>
#include <iostream>
#include <fstream>
#include "ods.h"
namespace po = boost::program_options;
+namespace fs = boost::filesystem;
+
using namespace std;
class Config{