ProcessExecutablePathWPE.cpp [plain text]
#include "config.h"
#include "ProcessExecutablePath.h"
#include <WebCore/FileSystem.h>
#include <glib.h>
#include <wtf/glib/GLibUtilities.h>
using namespace WebCore;
namespace WebKit {
static String getExecutablePath()
{
CString executablePath = getCurrentExecutablePath();
if (!executablePath.isNull())
return directoryName(stringFromFileSystemRepresentation(executablePath.data()));
return String();
}
static String findWebKitProcess(const char* processName)
{
static const char* execDirectory = g_getenv("WEBKIT_EXEC_PATH");
if (execDirectory) {
String processPath = pathByAppendingComponent(stringFromFileSystemRepresentation(execDirectory), processName);
if (fileExists(processPath))
return processPath;
}
static String executablePath = getExecutablePath();
if (!executablePath.isNull()) {
String processPath = pathByAppendingComponent(executablePath, processName);
if (fileExists(processPath))
return processPath;
}
return pathByAppendingComponent(stringFromFileSystemRepresentation(LIBEXECDIR), processName);
}
String executablePathOfWebProcess()
{
return findWebKitProcess("WPEWebProcess");
}
String executablePathOfPluginProcess()
{
return findWebKitProcess("WPEPluginProcess");
}
String executablePathOfNetworkProcess()
{
return findWebKitProcess("WPENetworkProcess");
}
#if ENABLE(DATABASE_PROCESS)
String executablePathOfDatabaseProcess()
{
return findWebKitProcess("WPEDatabaseProcess");
}
#endif
}