Mac: use recollhelperpath config variable to set the PATH for the .app, cant find a way with launchd
This commit is contained in:
parent
c534afede0
commit
42ae344aa8
@ -273,35 +273,6 @@ RclConfig *recollinit(int flags,
|
||||
if (cleanup)
|
||||
atexit(cleanup);
|
||||
|
||||
#ifdef __APPLE__
|
||||
// The MACPORTS and HOMEBREW flags are set by the resp. portfile
|
||||
// and recipee
|
||||
|
||||
// Apple keeps changing the way to set the environment (PATH) for
|
||||
// a desktop app (started by launchd or whatever). Life is too
|
||||
// short.
|
||||
const char *cp = getenv("PATH");
|
||||
if (!cp) //??
|
||||
cp = "";
|
||||
string PATH(cp);
|
||||
#if defined(MACPORTS)
|
||||
PATH = string("/opt/local/bin/") + ":" + PATH;
|
||||
#elif defined(HOMEBREW)
|
||||
PATH = string("/usr/local/bin/") + ":" + PATH;
|
||||
#else
|
||||
// Native qt build. Add our own directory to the path so that
|
||||
// recoll finds recollindex pkgdatadir:
|
||||
// /Applications/recoll.app/Contents/Resources
|
||||
//
|
||||
// NOTE: This does not work when running from a mounted dmg
|
||||
// because the location contains colons:/Volumes/:Users:dockes:Recoll:...
|
||||
// which messes with the PATH colon separators of course.
|
||||
std::string exedir = path_cat(path_getfather(path_pkgdatadir()), "MacOS");
|
||||
PATH = exedir + ":" + PATH;
|
||||
#endif
|
||||
setenv("PATH", PATH.c_str(), 1);
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
// Make sure the locale is set. This is only for converting file names
|
||||
// to utf8 for indexing.
|
||||
setlocale(LC_CTYPE, "");
|
||||
@ -321,6 +292,52 @@ RclConfig *recollinit(int flags,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
// Setting the PATH for a desktop app
|
||||
//
|
||||
// Apple keeps changing the way to set the environment (PATH) for
|
||||
// a desktop app (started by launchd or whatever). Life is too
|
||||
// short.
|
||||
//
|
||||
// The MACPORTS and HOMEBREW flags are set by the resp. portfile
|
||||
// and recipee. The hard-coded values of paths added for MACPORTS
|
||||
// and HOMEBREW could be replaced with recollhelperpath use. Kept
|
||||
// to minimize disturbance.
|
||||
|
||||
const char *cp = getenv("PATH");
|
||||
if (!cp) //??
|
||||
cp = "";
|
||||
string PATH(cp);
|
||||
|
||||
#if defined(MACPORTS)
|
||||
PATH = string("/opt/local/bin/") + ":" + PATH;
|
||||
#elif defined(HOMEBREW)
|
||||
PATH = string("/usr/local/bin/") + ":" + PATH;
|
||||
#else
|
||||
// Native qt build. Add our own directory to the path so that
|
||||
// recoll finds recollindex pkgdatadir:
|
||||
// /Applications/recoll.app/Contents/Resources
|
||||
//
|
||||
// NOTE: This does not work when running from a mounted dmg
|
||||
// because the location contains colons:/Volumes/:Users:dockes:Recoll:...
|
||||
// which messes with the PATH colon separators of course.
|
||||
//
|
||||
// Also, as far as I can see launchd actually includes the
|
||||
// directory in the PATH, so this is redundant. Otoh, launchd
|
||||
// changes a lot...
|
||||
std::string exedir = path_cat(path_getfather(path_pkgdatadir()), "MacOS");
|
||||
PATH = exedir + ":" + PATH;
|
||||
#endif
|
||||
|
||||
std::string rhpp
|
||||
if (config->getConfParam("recollhelperpath", rhpp) && !rhpp.empty()) {
|
||||
PATH = rhpp + ":" + PATH;
|
||||
}
|
||||
|
||||
setenv("PATH", PATH.c_str(), 1);
|
||||
LOGDEB("Rclinit: PATH [" << getenv("PATH") << "]\n");
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
TextSplit::staticConfInit(config);
|
||||
|
||||
// Retrieve the log file name and level. Daemon and batch indexing
|
||||
|
||||
@ -732,7 +732,9 @@ checkneedretryindexscript = rclcheckneedretry.sh
|
||||
# <var name="recollhelperpath" type="string">
|
||||
#
|
||||
# <brief>Additional places to search for helper executables.</brief>
|
||||
# <descr>This is only used on Windows for now.</descr></var>
|
||||
# <descr>This is used on Windows by the Python code, and on Mac OS by
|
||||
# the bundled recoll.app (because I could find no reliable way to tell
|
||||
# launchd to set the PATH. The example below is for Windows.</descr></var>
|
||||
#recollhelperpath = c:/someprog/bin;c:/someotherprog/bin
|
||||
|
||||
# <var name="idxabsmlen" type="int">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user