Hi Stuart,

On 08/03/18 13:21, Stuart Henderson wrote:
std::string proc_self_dirname()
{
         // No direct way to get the process executable base path
        char path[PATH_MAX];
        ssize_t buflen = sizeof(path);
         char *res = realpath(getenv("_"), path);
         if (!res) {
                log_error("getenv(\"_\") failed: %s\n",strerror(errno));
         }
        *(strrchr(path, '/')+1) = '\0';
        while (buflen > 0 && path[buflen-1] != '/')
                buflen--;
        return std::string(path, buflen);
}

If you think that's acceptable, I'll submit the patch upstream.
IMO hardcoding the path is the most sensible way for ports.


Do you mean something like this?

std::string proc_self_dirname()
{
        return "/usr/local/bin/";
}

How does it play with a different $LOCALBASE?

--
Alessandro DE LAURENZIS
[mailto:jus...@atlantide.t28.net]
Web: http://www.atlantide.t28.net
LinkedIn: http://it.linkedin.com/in/delaurenzis

Reply via email to