blob: d722594f6d77346c73c7272d511dab1f5d9c99d9 [file] [log] [blame]
diff --git a/mingw-w64-tools/widl/src/widl.c b/mingw-w64-tools/widl/src/widl.c
index aa669713..6a5ca69f 100644
--- a/mingw-w64-tools/widl/src/widl.c
+++ b/mingw-w64-tools/widl/src/widl.c
@@ -42,6 +42,7 @@
#include "parser.h"
#include "wine/wpp.h"
#include "header.h"
+#include "pathtools.h"
static const char usage[] =
"Usage: widl [options...] infile.idl\n"
@@ -749,14 +750,17 @@ int main(int argc,char *argv[])
if (stdinc)
{
- static const char *incl_dirs[] = { INCLUDEDIR, "/usr/include", "/usr/local/include" };
-
- for (i = 0; i < ARRAY_SIZE(incl_dirs); i++)
- {
- if (i && !strcmp( incl_dirs[i], incl_dirs[0] )) continue;
- wpp_add_include_path( strmake( "%s%s/wine/msvcrt", sysroot, incl_dirs[i] ));
- wpp_add_include_path( strmake( "%s%s/wine/windows", sysroot, incl_dirs[i] ));
+ char exe_path[PATH_MAX];
+ get_executable_path (argv[0], &exe_path[0], sizeof (exe_path) / sizeof (exe_path[0]));
+ char * rel_to_includedir = get_relative_path (DEFAULT_BINDIR, INCLUDEDIR);
+ if (strrchr (exe_path, '/') != NULL) {
+ strrchr (exe_path, '/')[1] = '\0';
}
+ char relocated_default_include_dir[PATH_MAX];
+ strcpy (relocated_default_include_dir, exe_path);
+ strcat (relocated_default_include_dir, rel_to_includedir);
+ simplify_path (&relocated_default_include_dir[0]);
+ wpp_add_include_path(relocated_default_include_dir);
}
switch (target_cpu)