| 45 | } |
| 46 | |
| 47 | bool TryRun(const std::filesystem::path& projectPath) |
| 48 | { |
| 49 | const auto errorEvent = [](OvWindowing::Context::EDeviceError, std::string errMsg) { |
| 50 | errMsg = "Overload requires OpenGL 4.5 or newer.\r\n" + errMsg; |
| 51 | #ifdef _WIN32 |
| 52 | MessageBox(0, errMsg.c_str(), "Overload", MB_OK | MB_ICONSTOP); |
| 53 | #else |
| 54 | // Use zenity for error message on Linux |
| 55 | std::string command = "zenity --error --title=\"Overload\" --text=\"" + errMsg + "\" 2>/dev/null"; |
| 56 | std::system(command.c_str()); |
| 57 | #endif |
| 58 | }; |
| 59 | |
| 60 | std::unique_ptr<OvEditor::Core::Application> app; |
| 61 | |
| 62 | try |
| 63 | { |
| 64 | auto listenerId = OvWindowing::Context::Device::ErrorEvent += errorEvent; |
| 65 | app = std::make_unique<OvEditor::Core::Application>(projectPath); |
| 66 | OvWindowing::Context::Device::ErrorEvent -= listenerId; |
| 67 | } |
| 68 | catch (...) {} |
| 69 | |
| 70 | if (app) |
| 71 | { |
| 72 | app->Run(); |
| 73 | return true; |
| 74 | } |
| 75 | |
| 76 | return false; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | int main(int argc, char** argv) |
no test coverage detected