From fea3a92e93a38fe4b8a7d18003dfeed5de3afa47 Mon Sep 17 00:00:00 2001 From: GregoryLundberg Date: Wed, 12 Oct 2016 05:37:13 -0500 Subject: [PATCH] Suppress NO_FIFO_DIR message on WIN32 Clean up the #if guards to suppress the message and code which does not execute on Windows because it has no FIFO support. --- src/server/server.cpp | 37 +++++++++++++++---------------------- src/server/server.hpp | 2 ++ 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/server/server.cpp b/src/server/server.cpp index 3243b4591733..8854ee8977f3 100644 --- a/src/server/server.cpp +++ b/src/server/server.cpp @@ -214,7 +214,9 @@ server::server(int port, bool keep_alive, const std::string& config_file, size_t ip_log_(), failed_logins_(), user_handler_(nullptr), +#ifndef _WIN32 input_path_(), +#endif config_file_(config_file), cfg_(read_config()), accepted_versions_(), @@ -381,28 +383,19 @@ config server::read_config() const { } void server::load_config() { -#ifndef FIFODIR -# ifdef _MSC_VER -# pragma message ("No FIFODIR set") -# define FIFODIR "d:/" -# else -# ifdef _WIN32 -# define FIFODIR "d:/" -# else -# warning "No FIFODIR set" -# define FIFODIR "/var/run/wesnothd" -# endif -# endif -#endif - const std::string fifo_path = (cfg_["fifo_path"].empty() ? std::string(FIFODIR) + "/socket" : std::string(cfg_["fifo_path"])); - // Reset (replace) the input stream only if the FIFO path changed. - if(fifo_path != input_path_) { -#ifndef _WIN32 - input_.close(); -#endif - input_path_ = fifo_path; - setup_fifo(); - } +# ifndef _WIN32 +# ifndef FIFODIR +# warning No FIFODIR set +# define FIFODIR "/var/run/wesnothd" +# endif + const std::string fifo_path = (cfg_["fifo_path"].empty() ? std::string(FIFODIR) + "/socket" : std::string(cfg_["fifo_path"])); + // Reset (replace) the input stream only if the FIFO path changed. + if(fifo_path != input_path_) { + input_.close(); + input_path_ = fifo_path; + setup_fifo(); + } +# endif save_replays_ = cfg_["save_replays"].to_bool(); replay_save_path_ = cfg_["replay_save_path"].str(); diff --git a/src/server/server.hpp b/src/server/server.hpp index 9de4469c6253..c33a2da3437d 100644 --- a/src/server/server.hpp +++ b/src/server/server.hpp @@ -117,8 +117,10 @@ class server : public server_base return result; } +#ifndef _WIN32 /** server socket/fifo. */ std::string input_path_; +#endif const std::string config_file_; config cfg_;