daily pastebin goal
70%
SHARE
TWEET

Untitled

a guest Oct 23rd, 2018 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. na samym poczatku pliku otserv.cpp
  2. #include <boost/filesystem.hpp>
  3. #include <boost/range.hpp>
  4.  
  5. nad
  6.  
  7. //load spells data
  8.     std::cout << ":: Loading spells.xml...            ";
  9.     if(!spells.loadFromXml(g_config.DATA_DIR))
  10.     {
  11.         ErrorMessage("Unable to load spells.xml!");
  12.         return -1;
  13.     }
  14.     std::cout << "[done]" << std::endl;
  15.  
  16. dodaj
  17.  
  18. boost::filesystem::path latest;
  19.     std::time_t latest_tm{};
  20.  
  21.     for (auto&& entry : boost::make_iterator_range(boost::filesystem::directory_iterator("./saves/"), {})) {
  22.         boost::filesystem::path p = entry.path();
  23.         if (is_regular_file(p) && p.extension() == ".sql") {
  24.             std::time_t timestamp = boost::filesystem::last_write_time(p);
  25.             if (timestamp > latest_tm) {
  26.                 latest = p;
  27.                 latest_tm = timestamp;
  28.             }
  29.         }
  30.     }
  31.  
  32.     if (latest.empty())
  33.         std::cout << "Nothing found\n";
  34.     else
  35.         std::cout << "Last modified: " << latest << "\n";
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top