From c91a6abc0d9c84c94e44a8f64de5485601b970ea Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 20 Jun 2018 12:35:43 +0200 Subject: More support for Windows execution (installed case) --- odb/odb.cxx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/odb/odb.cxx b/odb/odb.cxx index 98f9f5d..4861e7d 100644 --- a/odb/odb.cxx +++ b/odb/odb.cxx @@ -528,26 +528,34 @@ main (int argc, char* argv[]) // to be precise), the DLL assembly magic we have for executables won't // help here. // - // To allow executing the ODB compiler in-place we add the odb.exe.dll/ + // To allow executing the ODB compiler in-place we add the odb.exe.dlls/ // directory to PATH. It is a bit of hack but then DLL assemblies for // DLLs is whole new level of insanity that we are unlikely to ever // touch. // + // And it turns out we have the same problem in the installed case: if + // the installation directory is not in PATH, then GCC won't find the + // DLLs the plugin needs. So we handle both here. + // { path d (plugin.directory ()); d.complete (); d.normalize (); - d /= path ("odb.exe.dll"); + d /= path ("odb.exe.dlls"); + + struct stat st; + if (stat (d.string ().c_str (), &st) != 0 || !S_ISDIR (st.st_mode)) + d = d.directory (); - string s ("PATH=" + d.string ()); + string v ("PATH=" + d.string ()); if (char const* p = getenv ("PATH")) { - s += ';'; - s += p; + v += ';'; + v += p; } - _putenv (s.c_str ()); + _putenv (v.c_str ()); } #endif #endif -- cgit v1.1