Resolve path when Bundles folder is a link

This would cause a crash if the Bundles folder was a symbolic link (e.g. to DropBox) since we assumed the entry itself had entries (but only directory nodes have entries).

This closes issue #321.
This commit is contained in:
Allan Odgaard
2012-09-05 15:21:03 +02:00
parent 4faeec4795
commit b3f5960546

View File

@@ -531,7 +531,7 @@ namespace bundles
bool local = true;
iterate(path, locations())
{
std::string const cwd = path::join(*path, "Bundles");
std::string cwd = path::join(*path, "Bundles");
std::map<std::string, fs::node_t>::const_iterator node = heads.find(cwd);
if(node == heads.end() || node->second.type() == fs::node_t::kNodeTypeMissing)
{
@@ -539,7 +539,14 @@ namespace bundles
continue;
}
citerate(fsBundle, *node->second.entries())
fs::node_t bundlesNode = resolve(cwd, node->second, heads);
if(bundlesNode.type() != fs::node_t::kNodeTypeDirectory || !bundlesNode.entries())
{
fprintf(stderr, "*** no bundles for path %s\n", bundlesNode.real_path(cwd).c_str());
continue;
}
citerate(fsBundle, *bundlesNode.entries())
{
if(text::lowercase(path::extension(fsBundle->name())) != ".tmbundle")
{