34#include <boost/thread/locks.hpp>
35#include <boost/thread/mutex.hpp>
36#include <boost/optional.hpp>
37#include <system_error>
72 std::unique_ptr<std::FILE, close_file> m_handle;
73 std::string m_filename;
91 std::FILE*
handle() const noexcept {
return m_handle.get(); }
92 const std::string&
filename() const noexcept {
return m_filename; }
130 std::string get_special_folder_path(
int nfolder,
bool iscreate);
149 std::error_code
replace_file(
const std::string& old_name,
const std::string& new_name);
167 bool r = TRUE == ::SetConsoleCtrlHandler(&win_handler, TRUE);
174 static struct sigaction sa;
175 memset(&sa, 0,
sizeof(
struct sigaction));
176 sa.sa_handler = posix_handler;
179 sigaction(SIGINT, &sa, NULL);
180 signal(SIGTERM, posix_handler);
181 signal(SIGPIPE, SIG_IGN);
190 static BOOL WINAPI win_handler(DWORD type)
192 if (CTRL_C_EVENT == type || CTRL_BREAK_EVENT == type)
198 MGINFO_RED(
"Got control signal " << type <<
". Exiting without saving...");
205 static void posix_handler(
int type)
212 static void handle_signal(
int type)
214 static boost::mutex m_mutex;
215 boost::unique_lock<boost::mutex> lock(m_mutex);
220 static std::function<void(
int)> m_handler;
231 int vercmp(
const char *v0,
const char *v1);
236 boost::optional<bool>
is_hdd(
const char *path);
242 std::string input_line_win();
unsigned __int64 uint64_t