OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mapdpath.h File Reference
#include <boost/filesystem/path.hpp>
#include "Logger.h"
#include <linux/limits.h>
#include <unistd.h>
+ Include dependency graph for mapdpath.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

std::string mapd_root_abs_path ()
 

Function Documentation

std::string mapd_root_abs_path ( )
inline

Definition at line 30 of file mapdpath.h.

References CHECK_GT, and CHECK_LT.

Referenced by Importer_NS::Importer::initGDAL(), main(), and start_calcite_server_as_daemon().

30  {
31 #ifdef __APPLE__
32  char abs_exe_path[PROC_PIDPATHINFO_MAXSIZE] = {0};
33  auto path_len = proc_pidpath(getpid(), abs_exe_path, sizeof(abs_exe_path));
34 #else
35  char abs_exe_path[PATH_MAX] = {0};
36  auto path_len = readlink("/proc/self/exe", abs_exe_path, sizeof(abs_exe_path));
37 #endif
38  CHECK_GT(path_len, 0);
39  CHECK_LT(static_cast<size_t>(path_len), sizeof(abs_exe_path));
40  boost::filesystem::path abs_exe_dir(std::string(abs_exe_path, path_len));
41  abs_exe_dir.remove_filename();
42 #ifdef XCODE
43  const auto mapd_root = abs_exe_dir.parent_path().parent_path();
44 #else
45  const auto mapd_root = abs_exe_dir.parent_path();
46 #endif
47  return mapd_root.string();
48 }
#define CHECK_GT(x, y)
Definition: Logger.h:202
#define CHECK_LT(x, y)
Definition: Logger.h:200

+ Here is the caller graph for this function: