Elevate Engine 1
Loading...
Searching...
No Matches
Elevate::Files Namespace Reference

Functions

void OpenWithDefaultApp (const std::string &filePath)
 

Function Documentation

◆ OpenWithDefaultApp()

void Elevate::Files::OpenWithDefaultApp ( const std::string &  filePath)

Definition at line 14 of file Files.h.

14 {
15 if (std::filesystem::exists(filePath)) {
16#ifdef _WIN32
17 // Windows
18 ShellExecuteA(NULL, "open", filePath.c_str(), NULL, NULL, SW_SHOWNORMAL);
19#elif __APPLE__
20 // macOS
21 std::string command = "open " + filePath + " &";
22 system(command.c_str());
23#elif __linux__
24 // Linux
25 std::string command = "xdg-open " + filePath + " &";
26 system(command.c_str());
27#else
28 EE_CORE_ERROR("Unsupported OS");
29#endif
30 }
31 else {
32 EE_CORE_ERROR("ERROR - Cannot open file '{0}', file not found.", filePath);
33 }
34 }