6#include "components/ErrorUtils.hpp"
17std::filesystem::path getSelfDir() {
20 GetModuleFileNameA(NULL, path, MAX_PATH);
21 return std::filesystem::path(path).parent_path();
23 char result[PATH_MAX];
24 ssize_t count = readlink(
"/proc/self/exe", result, PATH_MAX);
26 return std::filesystem::path(std::string(result, count)).parent_path();
28 return std::filesystem::current_path();
32int main(
int argc,
char* argv[]) {
33 std::string selectedPath;
40 selectedPath = selector.getSelectedProject();
42 }
catch (
const std::exception& e) {
47 if (selectedPath.empty()) {
48 vex::log(vex::LogLevel::ERROR,
"Project path was not passed!");
52 std::filesystem::path binDir = getSelfDir();
55 std::string exeName =
"VexEditor.exe";
56 std::filesystem::path fullPath = binDir / exeName;
58 if (!std::filesystem::exists(fullPath)) {
59 std::cerr <<
"[Error] Could not find editor at: " << fullPath << std::endl;
60 std::cout <<
"Press Enter to exit..." << std::endl;
65 const char* args[] = { fullPath.string().c_str(), selectedPath.c_str(), NULL };
66 _spawnv(_P_OVERLAY, fullPath.string().c_str(), args);
68 std::string exeName =
"VexEditor";
69 std::filesystem::path fullPath = binDir / exeName;
71 if (!std::filesystem::exists(fullPath)) {
72 std::cerr <<
"[Error] Could not find editor at: " << fullPath << std::endl;
73 std::cout <<
"Press Enter to exit..." << std::endl;
79 (
char*)exeName.c_str(),
80 (
char*)selectedPath.c_str(),
84 execv(fullPath.c_str(), args);
86 perror(
"execv failed");
87 std::cerr <<
"[Fatal] Failed to launch: " << fullPath << std::endl;
88 std::cout <<
"Press Enter to exit..." << std::endl;
Specialized Engine class for the initial project selection screen.
static const char * GetVersionString()
Returns the version string of the engine.
Specialized Engine class for the initial project selection screen.
void VEX_EXPORT log(const char *fmt,...)
Logs a formatted message.
void VEX_EXPORT handle_critical_exception(const std::exception &e)
Handles a critical exception, forcing termination.