32 #include "vfs/fife_boost_filesystem.h"
40 : m_rootNode(new ZipNode(
"/")) {
48 ZipNode* ZipTree::addNode(
const std::string& nodePath) {
49 bfs::path filePath(nodePath);
50 std::string filename = filePath.string();
55 if (filename[filename.length()-1] ==
'/') {
56 filename = filename.erase(filename.length()-1);
59 filePath = bfs::path(filename);
61 ZipNode* node = m_rootNode;
62 ZipNode* tempNode = 0;
63 ZipNode* returnNode = 0;
64 for (bfs::path::iterator iter = filePath.begin(); iter != filePath.end(); ++iter) {
66 tempNode = node->getChild(pathString);
71 node = node->addChild(pathString);
91 ZipNode* ZipTree::getNode(
const std::string& name)
const {
92 bfs::path filePath(name);
93 ZipNode* returnNode = 0;
94 ZipNode* tempNode = 0;
95 ZipNode* node = getRootNode();
96 for (bfs::path::iterator iter = filePath.begin(); iter != filePath.end(); ++iter) {
99 if (pathString ==
".." && (node != getRootNode())) {
101 node = node->getParent();
105 tempNode = node->getChild(pathString);
120 ZipNode* ZipTree::getRootNode()
const {
125 std::ostream&
operator<<(std::ostream& os,
const FIFE::ZipTree& zipTree) {
126 assert(zipTree.getRootNode() != 0);
128 os << *(zipTree.getRootNode());