37 #define GET_PATH_TO_EXECUTABLE "/proc/self/exe" 44 using std::regex_replace;
46 const regex SearchPathSplitter::EXTRACT_PATHSPEC (
"[^:]+");
61 throw error::Fatal (
"unable to discover path of running executable");
63 buff.resize(chars_read);
76 static const regex PICK_ORIGIN_TOKEN (
"\\$?ORIGIN/?");
77 static const string expandedOriginDir
78 = fsys::path (
findExePath()).parent_path().string() +
"/";
80 return regex_replace(src, PICK_ORIGIN_TOKEN, expandedOriginDir);
90 fsys::path modulePathName (moduleName);
93 while (!fsys::exists (modulePathName))
96 if (searchLocation.isValid())
97 modulePathName = fsys::path() / searchLocation.next() / moduleName;
99 throw error::Config (
"Module \""+moduleName.string()+
"\" not found" 100 + (searchPath.empty()?
".":
" in search path: "+searchPath));
103 TRACE (config,
"found module %s", modulePathName.string().c_str());
104 return modulePathName.string();
Helpers to handle directory search paths.
string findExePath()
retrieve the location of the executable
const size_t STRING_MAX_RELEVANT
safety guard: maximum number of chars to process.
Implementation namespace for support and library code.
string replaceMagicLinkerTokens(string const &src)
replace $ORIGIN tokens in the given string
Derived specific exceptions within Lumiera's exception hierarchy.
Marker types to indicate a literal string and a Symbol.
#define GET_PATH_TO_EXECUTABLE
how to retrieve the absolute path of the currently running executable on a Linux system: read the lin...
Lumiera error handling (C++ interface).
Helper: Access a path Specification as a sequence of filesystem Paths.
string resolveModulePath(fsys::path moduleName, string searchPath)
helper to establish the location to search for loadable modules, configuration files, icons and further resources.