OLD | NEW |
1 #include <AdblockPlus/FileSystem.h> | 1 #include <AdblockPlus/FileSystem.h> |
2 #include <stdexcept> | 2 #include <stdexcept> |
3 #include <sstream> | 3 #include <sstream> |
4 #include <vector> | 4 #include <vector> |
5 | 5 |
6 #include <AdblockPlus/JsValue.h> | 6 #include <AdblockPlus/JsValue.h> |
7 #include "FileSystemJsObject.h" | 7 #include "FileSystemJsObject.h" |
8 #include "Utils.h" | 8 #include "Utils.h" |
9 #include "Thread.h" | 9 #include "Thread.h" |
10 #include "Utils.h" | 10 #include "Utils.h" |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 { | 318 { |
319 AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::FromArguments(arg
uments); | 319 AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::FromArguments(arg
uments); |
320 AdblockPlus::JsValueList converted = jsEngine->ConvertArguments(arguments); | 320 AdblockPlus::JsValueList converted = jsEngine->ConvertArguments(arguments); |
321 | 321 |
322 if (converted.size() != 1) | 322 if (converted.size() != 1) |
323 return v8::ThrowException(v8::String::New( | 323 return v8::ThrowException(v8::String::New( |
324 "_fileSystem.resolve requires 1 parameter")); | 324 "_fileSystem.resolve requires 1 parameter")); |
325 | 325 |
326 std::string resolved = jsEngine->GetFileSystem()->Resolve(converted[0]->AsSt
ring()); | 326 std::string resolved = jsEngine->GetFileSystem()->Resolve(converted[0]->AsSt
ring()); |
327 | 327 |
328 return v8::String::New(resolved.c_str(), resolved.length()); | 328 return Utils::ToV8String(resolved); |
329 } | 329 } |
330 | 330 |
331 } | 331 } |
332 | 332 |
333 | 333 |
334 JsValuePtr FileSystemJsObject::Setup(JsEnginePtr jsEngine, JsValuePtr obj) | 334 JsValuePtr FileSystemJsObject::Setup(JsEnginePtr jsEngine, JsValuePtr obj) |
335 { | 335 { |
336 obj->SetProperty("read", jsEngine->NewCallback(::ReadCallback)); | 336 obj->SetProperty("read", jsEngine->NewCallback(::ReadCallback)); |
337 obj->SetProperty("write", jsEngine->NewCallback(::WriteCallback)); | 337 obj->SetProperty("write", jsEngine->NewCallback(::WriteCallback)); |
338 obj->SetProperty("move", jsEngine->NewCallback(::MoveCallback)); | 338 obj->SetProperty("move", jsEngine->NewCallback(::MoveCallback)); |
339 obj->SetProperty("remove", jsEngine->NewCallback(::RemoveCallback)); | 339 obj->SetProperty("remove", jsEngine->NewCallback(::RemoveCallback)); |
340 obj->SetProperty("stat", jsEngine->NewCallback(::StatCallback)); | 340 obj->SetProperty("stat", jsEngine->NewCallback(::StatCallback)); |
341 obj->SetProperty("resolve", jsEngine->NewCallback(::ResolveCallback)); | 341 obj->SetProperty("resolve", jsEngine->NewCallback(::ResolveCallback)); |
342 return obj; | 342 return obj; |
343 } | 343 } |
OLD | NEW |