[OS/2] Bug 355077: fix xulrunner-stub to work on OS/2, p=abwillis1+me, r=mkaply

git-svn-id: svn://10.0.0.236/trunk@218108 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mozilla%weilbacher.org 2007-01-10 08:43:08 +00:00
parent e602ea4c0b
commit a2b9df40b8
3 changed files with 36 additions and 2 deletions

View File

@ -166,6 +166,13 @@ GRE_GetGREPathWithProperties(const GREVersionRange *versions,
#elif XP_WIN
if (_fullpath(aBuffer, p, aBufLen))
return NS_OK;
#elif XP_OS2
// realpath on OS/2 returns a unix-ized path, so re-native-ize
if (realpath(p, aBuffer)) {
for (char* ptr = strchr(aBuffer, '/'); ptr; ptr = strchr(ptr, '/'))
*ptr = '\\';
return NS_OK;
}
#elif XP_BEOS
BPath path;
status_t result;

View File

@ -135,7 +135,7 @@ XPCOMGlueLoad(const char *xpcomFile)
GetFrozenFunctionsFunc sym;
ulrc = DosQueryProcAddr(h, 0, "NS_GetFrozenFunctions", (PFN*)&sym);
ulrc = DosQueryProcAddr(h, 0, "_NS_GetFrozenFunctions", (PFN*)&sym);
if (ulrc != NO_ERROR)
XPCOMGlueUnload();
@ -171,7 +171,9 @@ XPCOMGlueLoadXULFunctions(const nsDynamicFunctionLoad *symbols)
nsresult rv = NS_OK;
while (symbols->functionName) {
ulrc = DosQueryProcAddr(sXULLibrary, 0, symbols->functionName, (PFN*)symbols->function);
char buffer[512];
snprintf(buffer, sizeof(buffer), "_%s", symbols->functionName);
ulrc = DosQueryProcAddr(sXULLibrary, 0, buffer, (PFN*)symbols->function);
if (ulrc != NO_ERROR)
rv = NS_ERROR_LOSS_OF_SIGNIFICANT_DATA;

View File

@ -56,6 +56,15 @@
#elif defined(XP_MACOSX)
#include <CFBundle.h>
#define PATH_SEPARATOR_CHAR '/'
#elif defined (XP_OS2)
#define INCL_DOS
#define INCL_DOSMISC
#define INCL_DOSERRORS
#include <os2.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#define PATH_SEPARATOR_CHAR '\\'
#else
#include <unistd.h>
#include <sys/types.h>
@ -162,6 +171,13 @@ main(int argc, char **argv)
if (!::GetModuleFileName(NULL, iniPath, sizeof(iniPath)))
return 1;
#elif defined(XP_OS2)
PPIB ppib;
PTIB ptib;
DosGetInfoBlocks(&ptib, &ppib);
DosQueryModuleName(ppib->pib_hmte, sizeof(iniPath), iniPath);
#else
// on unix, there is no official way to get the path of the current binary.
// instead of using the MOZILLA_FIVE_HOME hack, which doesn't scale to
@ -266,6 +282,15 @@ main(int argc, char **argv)
return 1;
}
}
#ifdef XP_OS2
// On OS/2 we need to set BEGINLIBPATH to be able to find XULRunner DLLs
strcpy(tmpPath, greDir);
lastSlash = strrchr(tmpPath, PATH_SEPARATOR_CHAR);
if (lastSlash) {
*lastSlash = '\0';
}
DosSetExtLIBPATH(tmpPath, BEGIN_LIBPATH);
#endif
rv = XPCOMGlueStartup(greDir);
if (NS_FAILED(rv)) {