factored out unix (file descriptor based) implementation to make way for

a windows WM_COPYDATA based implementation.
This commit is contained in:
darin@netscape.com
2002-11-06 01:11:07 +00:00
parent 461261d2af
commit ead7c21f87
17 changed files with 711 additions and 570 deletions

View File

@@ -129,12 +129,35 @@ IPC_GetModuleByID(const nsID &id)
}
void
IPC_InitModuleReg(const char *modulesDir)
IPC_InitModuleReg(const char *exePath)
{
//
// register built-in modules
//
ipcModule *module = IPC_GetCommandModule();
AddModule(module->ID(), module, NULL);
if (modulesDir) {
//
// register plug-in modules
//
if (exePath && *exePath) {
static const char relModDir[] = "ipc/modules";
char *p = PL_strrchr(exePath, IPC_PATH_SEP_CHAR);
if (p == NULL) {
LOG(("unexpected exe path\n"));
return;
}
int baseLen = p - exePath;
int finalLen = baseLen + 1 + sizeof(relModDir);
// build full path to ipc modules
char *modulesDir = (char*) malloc(finalLen);
memcpy(modulesDir, exePath, baseLen);
modulesDir[baseLen] = IPC_PATH_SEP_CHAR;
memcpy(modulesDir + baseLen + 1, relModDir, sizeof(relModDir));
LOG(("loading libraries in %s\n", modulesDir));
//
// scan directory for IPC modules