diff options
author | Mark Palange (Mani) <palange@lindenlab.com> | 2009-09-28 17:57:51 -0700 |
---|---|---|
committer | Mark Palange (Mani) <palange@lindenlab.com> | 2009-09-28 17:57:51 -0700 |
commit | 65d8a5a11b3b6aa2a7d0e972dfaa90a3aaf02e07 (patch) | |
tree | eb2ff58516a05a6354c513e6a18e0e0033bf0421 /indra | |
parent | 76dd0fd2cf1bfa83d479e62104a2d5e7058c6506 (diff) |
Changed win32 generation of initial 'component_path' for webkit plugin.
DllMain() captures module handle.
Call to GetModuleFilePathA() gets the dll filepath, Filename is trimmed off.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/media_plugins/webkit/media_plugin_webkit.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 2928b7e6b3..b1bb5f23b9 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -48,6 +48,18 @@ #include <stdlib.h> #endif +#if LL_WINDOWS + // *NOTE:Mani - This captures the module handle fo rthe dll. This is used below + // to get the path to this dll for webkit initialization. + // I don't know how/if this can be done with apr... + namespace { HMODULE gModuleHandle;}; + BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+ {
+ gModuleHandle = (HMODULE) hinstDLL;
+ return TRUE;
+ }
+#endif + //////////////////////////////////////////////////////////////////////////////// // class MediaPluginWebKit : @@ -126,7 +138,31 @@ private: return false; } std::string application_dir = std::string( cwd ); + +#if LL_WINDOWS + //*NOTE:Mani - On windows, at least, the component path is the + // location of this dll's image file. + std::string component_dir; + char dll_path[_MAX_PATH]; + DWORD len = GetModuleFileNameA(gModuleHandle, (LPCH)&dll_path, _MAX_PATH); + while(len && dll_path[ len ] != ('\\') )
+ {
+ len--;
+ }
+ if(len >= 0) + { + dll_path[len] = 0; + component_dir = dll_path; + } + else + { + // *NOTE:Mani - This case should be an rare exception. + // GetModuleFileNameA should always give you a full path, no? + component_dir = application_dir; + } +#else std::string component_dir = application_dir; +#endif std::string profileDir = application_dir + "/" + "browser_profile"; // cross platform? // window handle - needed on Windows and must be app window. |