[Webkit-unassigned] [Bug 32711] New: Make paths relocatable on runtime

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Dec 18 06:18:39 PST 2009


https://bugs.webkit.org/show_bug.cgi?id=32711

           Summary: Make paths relocatable on runtime
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Windows XP
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: WebKit Gtk
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: fridrich.strba at bluewin.ch


In platform/graphics/gtk/ImageGtk.cpp, the position of the icon is computer
like this: fileName = String::format("%s/webkit-1.0/images/%s.png", DATA_DIR,
name).utf8()
This assumes that the runtime prefix will be identical to the configure-time
prefix, which is not to be assumed on windows. The generic solution for this
problem would be to simply get by win32 api call the position of the
libwebkit*.dll at runtime and compute the position from this information.
Something like:

#ifdef _WIN32
#  include <shlobj.h>
#  include <mbstring.h>
/* search for data relative to where we are installed */

static HMODULE hmodule;

#ifdef __cplusplus
extern "C" {
#endif
BOOL WINAPI
DllMain (HINSTANCE hinstDLL,
     DWORD     fdwReason,
     LPVOID    lpvReserved)
{
  switch (fdwReason)
    {
    case DLL_PROCESS_ATTACH:
      hmodule = hinstDLL;
      break;
    }

  return TRUE;
}
#ifdef __cplusplus
}
#endif

static char *
get_webkit_datadir (void)
{
  static char retval[1000];
  static int beenhere = 0;

  unsigned char *p;

  if (beenhere)
    return retval;

  if (!GetModuleFileName (hmodule, (CHAR *) retval, sizeof(retval) - 10))
    return DATA_DIR;

  p = _mbsrchr ((const unsigned char *) retval, '\\');
  *p = '\0';
  p = _mbsrchr ((const unsigned char *) retval, '\\');
  if (p) {
    if (stricmp ((const char *) (p+1), "bin") == 0)
      *p = '\0';
  }
  strcat (retval, "\\share");

  beenhere = 1;

  return retval;
}

#undef DATA_DIR
#define DATA_DIR get_webkit_datadir ()
#endif

which should work for the ImageGtk.cpp file. Although a more general solution
in line with what we are doing in evolution could be provided if we expect this
problem not to be an isolated one:
http://git.gnome.org/cgit/evolution/tree/e-util/e-win32-reloc.c

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list