diff --git a/src/scenedit/scen.fileio.cpp b/src/scenedit/scen.fileio.cpp index 5dd874e3..96abf699 100644 --- a/src/scenedit/scen.fileio.cpp +++ b/src/scenedit/scen.fileio.cpp @@ -154,8 +154,7 @@ void writeScenarioToXml(ticpp::Printer&& data, cScenario& scenario) { data.OpenElement("creator"); data.PushElement("type", "oboe"); data.PushElement("version", scenario.format_ed_version()); - // TODO: fill element - data.PushElement("os", ""); + data.PushElement("os", get_os_version()); data.CloseElement("creator"); data.OpenElement("game"); data.PushElement("num-towns", scenario.towns.size()); diff --git a/src/tools/winutil.hpp b/src/tools/winutil.hpp index 4237a8e1..9682d2aa 100644 --- a/src/tools/winutil.hpp +++ b/src/tools/winutil.hpp @@ -23,6 +23,8 @@ void setWindowFloating(sf::Window& win, bool floating); void init_fileio(); void launchURL(std::string url); +std::string get_os_version(); + fs::path nav_get_party(); fs::path nav_put_party(fs::path def = ""); fs::path nav_get_scenario(); diff --git a/src/tools/winutil.mac.mm b/src/tools/winutil.mac.mm index 3d3535fd..6814f592 100644 --- a/src/tools/winutil.mac.mm +++ b/src/tools/winutil.mac.mm @@ -10,6 +10,7 @@ #include #include #include +#include // TODO: I'm sure there's a better way to do this (maybe one that's keyboard layout agnostic) // The proper way would involve use of the TextEntered event @@ -89,6 +90,14 @@ char keyToChar(sf::Keyboard::Key key, bool isShift) { return 0; } +std::string get_os_version() { + NSProcessInfo* info = [NSProcessInfo processInfo]; + std::ostringstream os; + os << "Apple Mac OS X "; + os << [[info operatingSystemVersionString] cStringUsingEncoding:NSASCIIStringEncoding]; + return os.str(); +} + void makeFrontWindow(sf::Window& win) { sf::WindowHandle handle = win.getSystemHandle(); id nsHandle = id(handle);