aboutsummaryrefslogtreecommitdiff
path: root/src/core/file_sys/directory_sdmc.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2014-12-08 18:03:48 -0500
committerbunnei <bunneidev@gmail.com>2014-12-08 18:03:48 -0500
commit72ad73519ceb5ae6992858fcf0906879d19badf0 (patch)
treef00a218fc180df8cc39e922feb56a994af772d68 /src/core/file_sys/directory_sdmc.cpp
parent2aa2d341d04b10a5ecb49acbcf3579cf2c2ae35c (diff)
parent20d2ed09502f41519beb435a1300f2a57995c651 (diff)
Merge pull request #260 from archshift/opendir
Make OpenDirectory fail if the directory doesn't exist
Diffstat (limited to 'src/core/file_sys/directory_sdmc.cpp')
-rw-r--r--src/core/file_sys/directory_sdmc.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/core/file_sys/directory_sdmc.cpp b/src/core/file_sys/directory_sdmc.cpp
index 60a197ce9..0f156a127 100644
--- a/src/core/file_sys/directory_sdmc.cpp
+++ b/src/core/file_sys/directory_sdmc.cpp
@@ -19,15 +19,22 @@ Directory_SDMC::Directory_SDMC(const Archive_SDMC* archive, const Path& path) {
// TODO(Link Mauve): normalize path into an absolute path without "..", it can currently bypass
// the root directory we set while opening the archive.
// For example, opening /../../usr/bin can give the emulated program your installed programs.
- std::string absolute_path = archive->GetMountPoint() + path.AsString();
- FileUtil::ScanDirectoryTree(absolute_path, directory);
- children_iterator = directory.children.begin();
+ this->path = archive->GetMountPoint() + path.AsString();
+
}
Directory_SDMC::~Directory_SDMC() {
Close();
}
+bool Directory_SDMC::Open() {
+ if (!FileUtil::IsDirectory(path))
+ return false;
+ FileUtil::ScanDirectoryTree(path, directory);
+ children_iterator = directory.children.begin();
+ return true;
+}
+
/**
* List files contained in the directory
* @param count Number of entries to return at once in entries