Fix readdir on a linked directory
This commit is contained in:
parent
a579f58454
commit
3c412e1cb8
1 changed files with 12 additions and 6 deletions
|
@ -22,9 +22,8 @@ bool GetNodeFromPath(std::string path,
|
||||||
const base::DictionaryValue* root,
|
const base::DictionaryValue* root,
|
||||||
const base::DictionaryValue** out);
|
const base::DictionaryValue** out);
|
||||||
|
|
||||||
// Gets sub-file "name" from "dir".
|
// Gets the "files" from "dir".
|
||||||
bool GetChildNode(const base::DictionaryValue* root,
|
bool GetFilesNode(const base::DictionaryValue* root,
|
||||||
const std::string& name,
|
|
||||||
const base::DictionaryValue* dir,
|
const base::DictionaryValue* dir,
|
||||||
const base::DictionaryValue** out) {
|
const base::DictionaryValue** out) {
|
||||||
// Test for symbol linked directory.
|
// Test for symbol linked directory.
|
||||||
|
@ -36,9 +35,16 @@ bool GetChildNode(const base::DictionaryValue* root,
|
||||||
dir = linked_node;
|
dir = linked_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise search for the "files" map.
|
return dir->GetDictionaryWithoutPathExpansion("files", out);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gets sub-file "name" from "dir".
|
||||||
|
bool GetChildNode(const base::DictionaryValue* root,
|
||||||
|
const std::string& name,
|
||||||
|
const base::DictionaryValue* dir,
|
||||||
|
const base::DictionaryValue** out) {
|
||||||
const base::DictionaryValue* files = NULL;
|
const base::DictionaryValue* files = NULL;
|
||||||
return dir->GetDictionaryWithoutPathExpansion("files", &files) &&
|
return GetFilesNode(root, dir, &files) &&
|
||||||
files->GetDictionaryWithoutPathExpansion(name, out);
|
files->GetDictionaryWithoutPathExpansion(name, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +195,7 @@ bool Archive::Readdir(const base::FilePath& path,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const base::DictionaryValue* files;
|
const base::DictionaryValue* files;
|
||||||
if (!node->GetDictionaryWithoutPathExpansion("files", &files))
|
if (!GetFilesNode(header_.get(), node, &files))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
base::DictionaryValue::Iterator iter(*files);
|
base::DictionaryValue::Iterator iter(*files);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue