#include "executable.hpp" #ifdef __linux__ #define _EXEC_PATH_IMPL_ 1 #include #include #include boost::filesystem::path get_executable_path() { static char buf[PATH_MAX]; readlink("/proc/self/exe", buf, PATH_MAX); return buf; } #endif #ifdef __WINNT__ #define _EXEC_PATH_IMPL_ 1 #include boost::filesystem::path get_executable_path() { static char buf[MAX_PATH]; GetModuleFileNameA(NULL, buf, MAX_PATH); return buf; } #endif #ifndef _EXEC_PATH_IMPL_ #error "don't know how to get executable path" #endif boost::filesystem::path get_executable_directory() { return get_executable_path().parent_path(); }