diff --git a/binding-mri/oneshot-binding.cpp b/binding-mri/oneshot-binding.cpp index b933a36..fc253a6 100644 --- a/binding-mri/oneshot-binding.cpp +++ b/binding-mri/oneshot-binding.cpp @@ -107,6 +107,7 @@ void oneshotBindingInit() VALUE msg = rb_define_module_under(module, "Msg"); // Constants + rb_const_set(module, rb_intern("OS"), rb_str_new2(shState->oneshot().os().c_str())); rb_const_set(module, rb_intern("USER_NAME"), rb_str_new2(shState->oneshot().userName().c_str())); rb_const_set(module, rb_intern("SAVE_PATH"), rb_str_new2(shState->oneshot().savePath().c_str())); rb_const_set(module, rb_intern("DOCS_PATH"), rb_str_new2(shState->oneshot().docsPath().c_str())); diff --git a/src/oneshot.cpp b/src/oneshot.cpp index 98c350f..01e56fd 100644 --- a/src/oneshot.cpp +++ b/src/oneshot.cpp @@ -49,6 +49,7 @@ struct OneshotPrivate SDL_Window *window; // String data + std::string os; std::string lang; std::string userName; std::string savePath; @@ -183,6 +184,13 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : p->winPosChanged = false; p->allowExit = true; p->exiting = false; + #ifdef OS_W32 + p->os = "windows"; + #elif defined OS_OSX + p->os = "macos"; + #else + p->os = "linux"; + #endif /******************** * USERNAME/DOCS PATH @@ -373,6 +381,11 @@ void Oneshot::update() } } +const std::string &Oneshot::os() const +{ + return p->os; +} + const std::string &Oneshot::lang() const { return p->lang; diff --git a/src/oneshot.h b/src/oneshot.h index bc40a9a..bb02091 100644 --- a/src/oneshot.h +++ b/src/oneshot.h @@ -49,6 +49,7 @@ public: void update(); //Accessors + const std::string &os() const; const std::string &lang() const; const std::string &userName() const; const std::string &savePath() const;