28 #elif defined(__linux__) 30 #elif defined(__APPLE__) 31 # include <mach-o/dyld.h> 50 static bool initialized =
false;
64 char exePath[MAX_PATH];
65 HMODULE hModule = GetModuleHandle(NULL);
66 if (GetModuleFileName(NULL, exePath,
sizeof(exePath)) !=0); {
67 g_exec_path = canonical(system_complete(exePath));
69 #elif defined(__linux__) 70 char exePath[PATH_MAX + 1];
71 size_t size = ::readlink(
"/proc/self/exe", exePath,
sizeof(exePath));
73 if (size > 0 && size !=
sizeof(exePath)) {
75 g_exec_path = canonical(system_complete(exePath));
77 #elif defined(__APPLE__) 78 char exePath[PATH_MAX];
79 uint32_t size =
sizeof(exePath);
80 if (_NSGetExecutablePath(exePath, &size) == 0) {
81 g_exec_path = canonical(system_complete(exePath));
88 path exec_dir = g_exec_path.parent_path();
89 if (!g_exec_path.empty()) {
91 if (exec_dir.filename().string() ==
"MacOS") {
97 g_root_dir = exec_dir.parent_path();
106 g_bin_dir = exec_dir.parent_path();
107 g_root_dir = exec_dir.parent_path().parent_path();
110 if (exec_dir.filename().string() !=
"bin") {
112 g_bin_dir = exec_dir;
113 g_root_dir = exec_dir;
120 g_bin_dir = exec_dir;
121 g_root_dir = exec_dir.parent_path();
128 g_data_dir = g_root_dir /
"data";
129 g_data_dir = is_directory(g_data_dir) ? g_data_dir : path();
133 g_current_dir = system_complete(current_path());
137 g_output_dir = g_root_dir /
"output";
138 g_output_dir = is_directory(g_output_dir) ? g_output_dir : path();
149 return g_current_dir;
static boost::filesystem::path g_root_dir
static boost::filesystem::path getOutputDir()
Utility method: get the path to the output directory.
Interface for install directory queries.
static boost::filesystem::path g_data_dir
Time Dependent Person DataType.
Conversion from or to string.
static boost::filesystem::path getDataDir()
Utility method: get path to the directory for data files.
static boost::filesystem::path getExecPath()
Utility method: get name of executable.
static boost::filesystem::path getCurrentDir()
Utility method: get path to the current directory.
static std::string toLower(std::string const &source)
Builds a string with lower case characters only.
static boost::filesystem::path g_current_dir
static boost::filesystem::path getBinDir()
Utility method: get path to bin directory.
static boost::filesystem::path g_bin_dir
static void initialize()
Initialize all paths.
static boost::filesystem::path g_output_dir
static boost::filesystem::path getRootDir()
Utility method: get application installation root directory.
static boost::filesystem::path g_exec_path
static void check()
Check initialization.