Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- na samym poczatku pliku otserv.cpp
- #include <boost/filesystem.hpp>
- #include <boost/range.hpp>
- nad
- //load spells data
- std::cout << ":: Loading spells.xml... ";
- if(!spells.loadFromXml(g_config.DATA_DIR))
- {
- ErrorMessage("Unable to load spells.xml!");
- return -1;
- }
- std::cout << "[done]" << std::endl;
- dodaj
- boost::filesystem::path latest;
- std::time_t latest_tm{};
- for (auto&& entry : boost::make_iterator_range(boost::filesystem::directory_iterator("./saves/"), {})) {
- boost::filesystem::path p = entry.path();
- if (is_regular_file(p) && p.extension() == ".sql") {
- std::time_t timestamp = boost::filesystem::last_write_time(p);
- if (timestamp > latest_tm) {
- latest = p;
- latest_tm = timestamp;
- }
- }
- }
- if (latest.empty())
- std::cout << "Nothing found\n";
- else
- std::cout << "Last modified: " << latest << "\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement