Core: Add a method to obtain a Directory from an Archive.

This commit is contained in:
Emmanuel Gil Peyrot
2014-09-12 00:47:05 +02:00
parent 33b0d1081e
commit c14e5713f5
5 changed files with 44 additions and 0 deletions

View File

@ -8,6 +8,7 @@
#include "common/file_util.h"
#include "core/file_sys/archive_sdmc.h"
#include "core/file_sys/directory_sdmc.h"
#include "core/file_sys/file_sdmc.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
@ -44,6 +45,17 @@ std::unique_ptr<File> Archive_SDMC::OpenFile(const std::string& path, const Mode
return std::unique_ptr<File>(file);
}
/**
* Open a directory specified by its path
* @param path Path relative to the archive
* @return Opened directory, or nullptr
*/
std::unique_ptr<Directory> Archive_SDMC::OpenDirectory(const std::string& path) const {
DEBUG_LOG(FILESYS, "called path=%s", path.c_str());
Directory_SDMC* directory = new Directory_SDMC(this, path);
return std::unique_ptr<Directory>(directory);
}
/**
* Read data from the archive
* @param offset Offset in bytes to start reading archive from