#pragma once #include #ifdef _WIN32 #include #ifndef PATH_MAX #define PATH_MAX 4096 #endif namespace nxl::os { std::string getApplicationDirectory() { char exePath[PATH_MAX]; GetModuleFileNameA(NULL, exePath, PATH_MAX); std::string exeDir = std::string(dirname(exePath)); return exeDir; } } // namespace nxl::os #else #include #include #include namespace nxl::os { std::string getApplicationDirectory() { char result[PATH_MAX] = {0}; std::string path; ssize_t count = readlink("/proc/self/exe", result, PATH_MAX); if (count != -1) { result[count] = '\0'; path = dirname(result); } else { path = "./"; } return path; } } // namespace nxl::os #endif