15 #include <mach-o/dyld.h> 26 std::string exec_path;
29 #if defined(__APPLE__) 30 uint32_t size =
sizeof(path);
31 if (_NSGetExecutablePath(path, &size) == 0)
34 mooseError(
"Unable to retrieve executable path");
35 #elif defined(__WIN32__) 37 #else // Linux with Proc 38 std::ostringstream oss;
39 oss <<
"/proc/" << getpid() <<
"/exe";
40 int ch = readlink(oss.str().c_str(), path, 1024);
55 std::string::size_type t = exec_path.find_last_of(
"/");
56 return exec_path.substr(0, t) +
"/";
64 std::string::size_type start =
name.find_last_of(
"/");
65 if (start == std::string::npos)
67 return name.substr(start, std::string::npos);
std::string name(const ElemQuality q)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
std::string getExecutablePath()
This function returns the PATH of the running executable.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
std::string getExecutableName()
This function returns the name of the running executable.