changed some stuff with directories

This commit is contained in:
Johannes Wendel
2019-08-22 21:50:27 +02:00
parent e7649daf2e
commit 04d1f73b97
2 changed files with 20 additions and 4 deletions

View File

@@ -18,6 +18,7 @@
#include <fstream>
#include <algorithm>
#include <numeric>
#include <experimental/filesystem>
int main(int argc, char** argv)
{
@@ -36,6 +37,8 @@ using namespace Poco::Util;
using namespace Poco::JSON;
using namespace Poco;
namespace fs = std::experimental::filesystem;
FlippRServer::FlippRServer() :
help_requested(false),
input_port(9980),
@@ -190,16 +193,27 @@ TCPServer* FlippRServer::build_input_server()
{
unsigned short port = (unsigned short) config().getInt("FlippRServer.port", this->output_port);
std::string runtime_dir = this->get_runtime_dir();
SocketAddress address(path);
SocketAddress address(runtime_dir + SOCKET_NAME);
logger().information("Input-Server address is set to: " + address.toString());
ServerSocket server_socket(address);
return new TCPServer(new input::InputSocketHandlerFactory(this->input_driver), port);
}
std::string FlippRServer::create_directory(std::string file_name)
{
std::string runtime_dir = this->get_runtime_dir();
fs::path path = runtime_dir + file_name;
if(!fs::exists(path))
{
fs::create_directory(path);
}
return path;
}
void FlippRServer::defineOptions(OptionSet& options)
{
ServerApplication::defineOptions(options);

View File

@@ -34,6 +34,8 @@ public:
private:
void initialize_output_driver();
void initialize_input_driver();
std::string create_directory(std::string file_name);
void parse_server_config_file();
std::string get_runtime_dir();