(FreeBSD) Added fallback method to locate binary

This commit is contained in:
Leon Styhre 2024-08-19 17:22:30 +02:00
parent 338843ce46
commit bd6956d52f

View file

@ -375,6 +375,14 @@ namespace Utils
esBinary = exePath;
exePath = getCanonicalPath(exePath);
#if defined(__FreeBSD__)
// Fallback to getPathToBinary(argv[0]), needed as FreeBSD does not typically
// provide /proc/self/exe.
if (exePath.empty()) {
esBinary = getPathToBinary(path);
exePath = getCanonicalPath(esBinary);
}
#endif
// Fallback to argv[0] if everything else fails.
if (exePath.empty()) {
esBinary = path;