| Index: src/engine/main.cpp |
| =================================================================== |
| --- a/src/engine/main.cpp |
| +++ b/src/engine/main.cpp |
| @@ -157,36 +157,43 @@ namespace |
| } |
| // TODO: Keep the pipe open until the client disconnects |
| return 0; |
| } |
| } |
| -std::auto_ptr<AdblockPlus::FilterEngine> CreateFilterEngine() |
| +std::auto_ptr<AdblockPlus::FilterEngine> CreateFilterEngine(const std::wstring& locale) |
| { |
| - // TODO: Pass appInfo in, which should be sent by the client |
| - AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::New(); |
| + AdblockPlus::AppInfo appInfo; |
|
Felix Dahlke
2013/06/04 09:46:09
The version's missing, would like to see at least
|
| + appInfo.name = "adblockplusie"; |
| + appInfo.platform = "msie"; |
| + appInfo.locale = ToUtf8String(locale); |
| + |
| + AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::New(appInfo); |
| std::string dataPath = ToUtf8String(GetAppDataPath()); |
| dynamic_cast<AdblockPlus::DefaultFileSystem*>(jsEngine->GetFileSystem().get())->SetBasePath(dataPath); |
| std::auto_ptr<AdblockPlus::FilterEngine> filterEngine(new AdblockPlus::FilterEngine(jsEngine)); |
| return filterEngine; |
| } |
| int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) |
| { |
| // TODO: Attempt to create the pipe first, and exit immediately if this |
| // fails. Since multiple instances of the engine could be running, |
| // this may need named mutices to avoid race conditions. |
| // Note that as soon as the pipe is created first, we can reduce the |
| // client timeout after CreateProcess(), but should increase the one |
| // in WaitNamedPipe(). |
| - filterEngine = CreateFilterEngine(); |
| + int argc; |
| + LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc); |
|
Felix Dahlke
2013/06/04 09:46:09
According to the docs, you need to free argv using
|
| + std::wstring locale(argc >= 1 ? argv[0] : L""); |
| + filterEngine = CreateFilterEngine(locale); |
| for (;;) |
| { |
| try |
| { |
| Communication::Pipe* pipe = new Communication::Pipe(Communication::pipeName, |
| Communication::Pipe::MODE_CREATE); |