Mercurial > fife-parpg
changeset 202:1d9154c535cf
fixed bug where the root directory path name was being added to the filename twice. It was initially added in the listFiles/listDirectories functions and then added again in the private function list. I modified the code so it is only added in the list function now.
author | vtchill@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 13 Mar 2009 03:05:14 +0000 |
parents | a9c4b895ed02 |
children | 44919eb74c40 |
files | engine/core/vfs/vfsdirectory.cpp |
diffstat | 1 files changed, 11 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/engine/core/vfs/vfsdirectory.cpp Fri Mar 13 02:47:03 2009 +0000 +++ b/engine/core/vfs/vfsdirectory.cpp Fri Mar 13 03:05:14 2009 +0000 @@ -66,7 +66,17 @@ } std::set<std::string> VFSDirectory::listFiles(const std::string& path) const { + return list(path, false); + } + + std::set<std::string> VFSDirectory::listDirectories(const std::string& path) const { + return list(path, true); + } + + std::set<std::string> VFSDirectory::list(const std::string& path, bool directorys) const { + std::set<std::string> list; std::string dir = m_root; + // Avoid double slashes if(path[0] == '/' && m_root[m_root.size()-1] == '/') { dir.append(path.substr(1)); @@ -75,25 +85,7 @@ dir.append(path); } - return list(dir, false); - } - - std::set<std::string> VFSDirectory::listDirectories(const std::string& path) const { - std::string dir = m_root; - // Avoid double slashes - if(path[0] == '/' && m_root[m_root.size()-1] == '/') { - dir.append(path.substr(1)); - } - else { - dir.append(path); - } - - return list(dir, true); - } - - std::set<std::string> VFSDirectory::list(const std::string& path, bool directorys) const { - std::set<std::string> list; - bfs::path boost_path(m_root + path); + bfs::path boost_path(dir); if (!bfs::exists(boost_path) || !bfs::is_directory(boost_path)) return list;