22 #include <linux/limits.h>
26 #include <boost/filesystem/path.hpp>
34 char abs_exe_path[PROC_PIDPATHINFO_MAXSIZE] = {0};
35 auto path_len = proc_pidpath(getpid(), abs_exe_path,
sizeof(abs_exe_path));
37 char abs_exe_path[PATH_MAX] = {0};
38 auto path_len = readlink(
"/proc/self/exe", abs_exe_path,
sizeof(abs_exe_path));
41 CHECK_LT(static_cast<size_t>(path_len),
sizeof(abs_exe_path));
42 boost::filesystem::path abs_exe_dir(std::string(abs_exe_path, path_len));
43 abs_exe_dir.remove_filename();
45 const auto mapd_root = abs_exe_dir.parent_path().parent_path();
47 const auto mapd_root = abs_exe_dir.parent_path();
49 return mapd_root.string();
std::string get_root_abs_path()