MCPcopy Create free account
hub / github.com/Overload-Technologies/Overload / TryRun

Function TryRun

Sources/OvEditor/src/OvEditor/Main.cpp:47–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
80int main(int argc, char** argv)

Callers 1

mainFunction · 0.85

Calls 3

MessageBoxClass · 0.85
c_strMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected