Bug 332074, [BEOS]Fix XPCOMGlue for BeOS, p=sergei_d, r=thesuckiestemail, r=bsmedberg

This commit is contained in:
sergei_d%fi.tartu.ee 2006-09-27 16:07:06 +00:00
parent 349a00107e
commit 01d37fecbd
2 changed files with 78 additions and 4 deletions

View File

@ -205,8 +205,9 @@ NS_GetFrozenFunctions(XPCOMFunctions *entryPoints, const char* libraryPath);
#elif defined(XP_BEOS)
#define XPCOM_SEARCH_KEY "ADDON_PATH"
#define GRE_CONF_NAME ".gre.config"
#define GRE_CONF_PATH "/boot/home/config/settings/GRE/gre.conf"
#define GRE_CONF_NAME "gre.config"
#define GRE_CONF_PATH "gre.conf"
#define GRE_CONF_DIR "gre.d"
#define XPCOM_DLL "libxpcom"MOZ_DLL_SUFFIX
#define XUL_DLL "libxul"MOZ_DLL_SUFFIX

View File

@ -71,6 +71,8 @@
# include <sys/param.h>
# include <OS.h>
# include <image.h>
# include <dirent.h>
# include <FindDirectory.h>
#endif
#include <sys/stat.h>
@ -114,7 +116,7 @@ GRE_FindGREFramework(const char* rootPath,
PRUint32 propertiesLength,
char* buffer, PRUint32 buflen);
#elif defined(XP_UNIX)
#elif defined(XP_UNIX) || defined(XP_BEOS)
static PRBool
GRE_GetPathFromConfigDir(const char* dirname,
@ -164,6 +166,15 @@ GRE_GetGREPathWithProperties(const GREVersionRange *versions,
#elif XP_WIN
if (_fullpath(aBuffer, p, aBufLen))
return NS_OK;
#elif XP_BEOS
BPath path;
status_t result;
result = path.SetTo(p,0,true);
if (result == B_OK)
{
sprintf(aBuffer, path.Path());
return NS_OK;
}
#else
// hope for the best
// xxxbsmedberg: other platforms should have a "make absolute" function
@ -305,6 +316,68 @@ GRE_GetGREPathWithProperties(const GREVersionRange *versions,
return NS_OK;
}
#elif defined(XP_BEOS)
env = getenv("MOZ_GRE_CONF");
if (env && GRE_GetPathFromConfigFile(env,
versions, versionsLength,
properties, propertiesLength,
aBuffer, aBufLen)) {
return NS_OK;
}
char p[MAXPATHLEN];
if (find_directory(B_USER_SETTINGS_DIRECTORY, 0, 0, p, MAXPATHLEN)) {
char buffer[MAXPATHLEN];
// Look in B_USER_SETTINGS_DIRECTORY/gre.config
snprintf(buffer, sizeof(buffer),
"%s" XPCOM_FILE_PATH_SEPARATOR GRE_CONF_NAME, p);
if (GRE_GetPathFromConfigFile(buffer,
versions, versionsLength,
properties, propertiesLength,
aBuffer, aBufLen)) {
return NS_OK;
}
// Look in B_USER_SETTINGS_DIRECTORY/gre.d/*.conf
snprintf(buffer, sizeof(buffer),
"%s" XPCOM_FILE_PATH_SEPARATOR GRE_CONF_DIR, p);
if (GRE_GetPathFromConfigDir(buffer,
versions, versionsLength,
properties, propertiesLength,
aBuffer, aBufLen)) {
return NS_OK;
}
}
// Hope Zeta OS and Haiku OS multiuser versions will respect BeBook,
// for BeOS R5 COMMON and USER are equal
if (find_directory(B_COMMON_SETTINGS_DIRECTORY, 0, 0, p, MAXPATHLEN)) {
char buffer[MAXPATHLEN];
// Look for a B_COMMON_SETTINGS_DIRECTORY/gre.conf file
snprintf(buffer, sizeof(buffer),
"%s" XPCOM_FILE_PATH_SEPARATOR GRE_CONF_PATH, p);
if (GRE_GetPathFromConfigFile(buffer,
versions, versionsLength,
properties, propertiesLength,
aBuffer, aBufLen)) {
return NS_OK;
}
// Look for a group of config files in B_COMMON_SETTINGS_DIRECTORY/gre.d/
snprintf(buffer, sizeof(buffer),
"%s" XPCOM_FILE_PATH_SEPARATOR GRE_CONF_DIR, p);
if (GRE_GetPathFromConfigDir(buffer,
versions, versionsLength,
properties, propertiesLength,
aBuffer, aBufLen)) {
return NS_OK;
}
}
#elif defined(XP_WIN)
HKEY hRegKey = NULL;
@ -412,7 +485,7 @@ GRE_FindGREFramework(const char* rootPath,
return PR_FALSE;
}
#elif defined(XP_UNIX)
#elif defined(XP_UNIX) || defined(XP_BEOS)
static PRBool IsConfFile(const char *filename)
{