Add asar.stat method.

This commit is contained in:
Cheng Zhao 2014-09-24 12:02:33 +08:00
parent 0d09143a77
commit 8199ad2ae6
3 changed files with 67 additions and 10 deletions

View file

@ -18,10 +18,18 @@ namespace asar {
class Archive : public base::RefCounted<Archive> {
public:
struct FileInfo {
FileInfo() : size(0), offset(0) {}
uint32 size;
uint64 offset;
};
struct Stats : public FileInfo {
Stats() : is_file(true), is_directory(false), is_link(false) {}
bool is_file;
bool is_directory;
bool is_link;
};
explicit Archive(const base::FilePath& path);
// Read and parse the header.
@ -30,6 +38,9 @@ class Archive : public base::RefCounted<Archive> {
// Get the info of a file.
bool GetFileInfo(const base::FilePath& path, FileInfo* info);
// Fs.stat(path).
bool Stat(const base::FilePath& path, Stats* stats);
base::FilePath path() const { return path_; }
base::DictionaryValue* header() const { return header_.get(); }