Add a way to copy a file in archive into filesystem.
This commit is contained in:
parent
e5e1e207b6
commit
c95a93ef1c
6 changed files with 138 additions and 1 deletions
|
@ -67,13 +67,23 @@ class Archive : public mate::Wrappable {
|
|||
return mate::ConvertToV8(isolate, files);
|
||||
}
|
||||
|
||||
// Copy the file out into a temporary file and returns the new path.
|
||||
v8::Handle<v8::Value> CopyFileOut(v8::Isolate* isolate,
|
||||
const base::FilePath& path) {
|
||||
base::FilePath new_path;
|
||||
if (!archive_->CopyFileOut(path, &new_path))
|
||||
return v8::False(isolate);
|
||||
return mate::ConvertToV8(isolate, new_path);
|
||||
}
|
||||
|
||||
// mate::Wrappable:
|
||||
mate::ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate* isolate) {
|
||||
return mate::ObjectTemplateBuilder(isolate)
|
||||
.SetValue("path", archive_->path())
|
||||
.SetMethod("getFileInfo", &Archive::GetFileInfo)
|
||||
.SetMethod("stat", &Archive::Stat)
|
||||
.SetMethod("readdir", &Archive::Readdir);
|
||||
.SetMethod("readdir", &Archive::Readdir)
|
||||
.SetMethod("copyFileOut", &Archive::CopyFileOut);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue