Skip to content

Commit

Permalink
Merge pull request #823 from GregoryLundberg/GL_No_FIFODIR
Browse files Browse the repository at this point in the history
Suppress NO_FIFO_DIR message on WIN32
  • Loading branch information
jyrkive committed Oct 13, 2016
2 parents 2cc92e8 + fea3a92 commit 2d84467
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
37 changes: 15 additions & 22 deletions src/server/server.cpp
Expand Up @@ -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_(),
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions src/server/server.hpp
Expand Up @@ -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_;
Expand Down

0 comments on commit 2d84467

Please sign in to comment.