12#ifndef MCRL2_BASENAME_H
13#define MCRL2_BASENAME_H
21#ifdef MCRL2_PLATFORM_LINUX
25#ifdef MCRL2_PLATFORM_WINDOWS
29#ifdef MCRL2_PLATFORM_MAC
30#include <mach-o/dyld.h>
44#ifdef MCRL2_PLATFORM_LINUX
48 sprintf(buf,
"%d",pid);
49 std::string _link =
"/proc/";
53 int ch = readlink(_link.c_str(),
proc,512);
58 std::string::size_type t = path.find_last_of(
"/");
59 path = path.substr(0,t);
63#ifdef MCRL2_PLATFORM_MAC
66 _NSGetExecutablePath(pathbuf, &bufsize);
67 pathbuf =
new char[bufsize];
68 if (_NSGetExecutablePath(pathbuf, &bufsize) != 0)
70 throw mcrl2::runtime_error(
"Could not retrieve path to main executable (_NSGetExecutablePath returned nonzero).");
74 std::string::size_type t = path.find_last_of(
"/");
75 path = path.substr(0,t);
78#ifdef MCRL2_PLATFORM_WINDOWS
79 char buffer[MAX_PATH];
80 GetModuleFileName(NULL, buffer,
sizeof(buffer));
82 std::string::size_type t = path.find_last_of(
"\\");
83 path = path.substr(0,t);
Standard exception class for reporting runtime errors.
Exception classes for use in libraries and tools.
std::string get_executable_basename()
Returns the basename of a tool.
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...