Commit 6f123e84 authored by Alexandre Julliard's avatar Alexandre Julliard

tools: Always fall back to argv[0] to find the tools directory.

parent 5ca22f55
......@@ -483,7 +483,7 @@ void write_id_data(const statement_list_t *stmts)
static void init_argv0_dir( const char *argv0 )
{
#ifndef _WIN32
char *dir;
char *dir = NULL;
#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
dir = realpath( "/proc/self/exe", NULL );
......@@ -494,10 +494,8 @@ static void init_argv0_dir( const char *argv0 )
if (!sysctl( pathname, ARRAY_SIZE(pathname), path, &path_size, NULL, 0 ))
dir = realpath( path, NULL );
free( path );
#else
dir = realpath( argv0, NULL );
#endif
if (!dir) return;
if (!dir && !(dir = realpath( argv0, NULL ))) return;
includedir = strmake( "%s/%s", get_dirname( dir ), BIN_TO_INCLUDEDIR );
dlldir = strmake( "%s/%s", get_dirname( dir ), BIN_TO_DLLDIR );
#endif
......
......@@ -647,7 +647,7 @@ static char *get_lib_dir( struct options *opts )
static void init_argv0_dir( const char *argv0 )
{
#ifndef _WIN32
char *dir;
char *dir = NULL;
#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
dir = realpath( "/proc/self/exe", NULL );
......@@ -658,10 +658,8 @@ static void init_argv0_dir( const char *argv0 )
if (!sysctl( pathname, ARRAY_SIZE(pathname), path, &path_size, NULL, 0 ))
dir = realpath( path, NULL );
free( path );
#else
dir = realpath( argv0, NULL );
#endif
if (!dir) return;
if (!dir && !(dir = realpath( argv0, NULL ))) return;
bindir = get_dirname( dir );
includedir = strmake( "%s/%s", bindir, BIN_TO_INCLUDEDIR );
libdir = strmake( "%s/%s", bindir, BIN_TO_LIBDIR );
......
......@@ -150,7 +150,7 @@ static void exit_on_signal( int sig )
static void init_argv0_dir( const char *argv0 )
{
#ifndef _WIN32
char *dir;
char *dir = NULL;
#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
dir = realpath( "/proc/self/exe", NULL );
......@@ -160,13 +160,9 @@ static void init_argv0_dir( const char *argv0 )
char *path = xmalloc( path_size );
if (!sysctl( pathname, ARRAY_SIZE(pathname), path, &path_size, NULL, 0 ))
dir = realpath( path, NULL );
else
dir = NULL;
free( path );
#else
dir = realpath( argv0, NULL );
#endif
if (!dir) return;
if (!dir && !(dir = realpath( argv0, NULL ))) return;
dir = get_dirname( dir );
if (strendswith( dir, "/tools/wmc" )) nlsdirs[0] = strmake( "%s/../../nls", dir );
else nlsdirs[0] = strmake( "%s/%s", dir, BIN_TO_NLSDIR );
......
......@@ -295,7 +295,7 @@ static int load_file( const char *input_name, const char *output_name )
static void init_argv0_dir( const char *argv0 )
{
#ifndef _WIN32
char *dir;
char *dir = NULL;
#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
dir = realpath( "/proc/self/exe", NULL );
......@@ -305,13 +305,9 @@ static void init_argv0_dir( const char *argv0 )
char *path = xmalloc( path_size );
if (!sysctl( pathname, ARRAY_SIZE(pathname), path, &path_size, NULL, 0 ))
dir = realpath( path, NULL );
else
dir = NULL;
free( path );
#else
dir = realpath( argv0, NULL );
#endif
if (!dir) return;
if (!dir && !(dir = realpath( argv0, NULL ))) return;
dir = get_dirname( dir );
includedir = strmake( "%s/%s", dir, BIN_TO_INCLUDEDIR );
if (strendswith( dir, "/tools/wrc" )) nlsdirs[0] = strmake( "%s/../../nls", dir );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment