29 #include <boost/filesystem.hpp> 33 #if defined(_WIN32) && defined(HR_ENGINE_SHARED) 35 # define MR_DllDeclare __declspec( dllexport ) 37 # define MR_DllDeclare __declspec( dllimport ) 40 # define MR_DllDeclare 57 using path_t = boost::filesystem::path;
58 using dirIter_t = boost::filesystem::directory_iterator;
59 using dirEnt_t = boost::filesystem::directory_entry;
64 using cpstr_t =
const path_t::value_type*;
66 void SetEnv(
const char *key,
const char *
val);
68 const std::string &reqLocale = {});
87 return laterTs - earlierTs;
93 bool OpenLink(
const std::string &url);
98 void ShowMessage(
const std::string &s,
bool error =
false);
boost::filesystem::filesystem_error fs_error_t
Definition: OS.h:61
constexpr timestamp_t TimeDiff(timestamp_t laterTs, timestamp_t earlierTs) noexcept
Calculate the difference between two timestamps.
Definition: OS.h:82
std::locale locale
Global reference to the current locale.
Definition: OS.cpp:98
FILE * FOpen(const path_t &path, const char *mode)
Open a file using the OS-specific path format.
Definition: OS.cpp:348
boost::filesystem::path path_t
Definition: OS.h:57
std::string StrError(int errnum)
Convert an error number to a string.
Definition: OS.cpp:198
boost::filesystem::directory_iterator dirIter_t
Definition: OS.h:58
void TimeInit()
Initialize the OS time source.
Definition: OS.cpp:206
const std::locale & SetLocale(const path_t &path, const std::string &domain, const std::string &reqLocale={})
Set the locale based on the current environment.
Definition: OS.cpp:156
void ShowMessage(const std::string &s, bool error=false)
Display a simple error message to the user.
Definition: OS.cpp:371
void SetEnv(const char *key, const char *val)
Set an environment variable.
Definition: OS.cpp:109
std::string FileTimeString()
Generate a string representing the current timestamp, suitable for filenames.
Definition: OS.cpp:238
timestamp_t Time()
Retrieve a timestamp.
Definition: OS.cpp:217
path_t::value_type * pstr_t
Definition: OS.h:63
const path_t::value_type * cpstr_t
Definition: OS.h:64
std::string GetUsername()
Get the username of the current OS user.
Definition: OS.cpp:418
OS::path_t FindExePath()
Find the path of the executable itself.
Definition: OS.cpp:386
bool OpenLink(const std::string &url)
Open a URL.
Definition: OS.cpp:276
boost::filesystem::directory_entry dirEnt_t
Definition: OS.h:59
luabind::object val
Definition: Rulebook.cpp:52
bool OpenPath(const path_t &path)
Open a filesystem path.
Definition: OS.cpp:317
Definition: Announcement.h:24
int64_t MR_Int64
Definition: MR_Types.h:45
const std::locale & stdLocale
The standard "C" locale for things that should be not be affected by locale.
Definition: OS.cpp:101
void TimeShutdown()
Shutdown the OS time source.
Definition: OS.cpp:266
MR_Int64 timestamp_t
Definition: OS.h:55