Exemplo n.º 1
0
bool Chat::checkMotd(std::string motdFile)
{
  //
  // Create motdfile is it doesn't exist
  //
  std::ifstream ifs(motdFile.c_str());

  // If file does not exist
  if(ifs.fail())
  {
    Mineserver::get()->screen()->log("> Warning: " + motdFile + " not found. Creating...");

    std::ofstream motdofs(motdFile.c_str());
    motdofs << MOTD_CONTENT << std::endl;
    motdofs.close();
  }

  ifs.close();

  return true;
}
Exemplo n.º 2
0
bool Chat::checkMotd(std::string motdFile)
{
  //
  // Create motdfile is it doesn't exist
  //
  std::ifstream ifs(motdFile.c_str());

  // If file does not exist
  if(ifs.fail())
  {
    std::cout << "> Warning: " << motdFile << " not found. Creating..." << std::endl;

    std::ofstream motdofs(motdFile.c_str());
    motdofs << MOTD_CONTENT << std::endl;
    motdofs.close();
  }

  ifs.close();

  return true;
}