diff --git a/FlippR-Driver/networking/FlippRServer.cpp b/FlippR-Driver/networking/FlippRServer.cpp index d4b7888..92597bd 100644 --- a/FlippR-Driver/networking/FlippRServer.cpp +++ b/FlippR-Driver/networking/FlippRServer.cpp @@ -18,6 +18,7 @@ #include #include #include +#include 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), @@ -197,6 +200,19 @@ TCPServer* FlippRServer::build_input_server() 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); diff --git a/FlippR-Driver/networking/FlippRServer.h b/FlippR-Driver/networking/FlippRServer.h index a8c2ce4..dc637b4 100644 --- a/FlippR-Driver/networking/FlippRServer.h +++ b/FlippR-Driver/networking/FlippRServer.h @@ -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();