mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-24 18:32:49 -06:00
DiskDirectory: Initialize the directory member with valid info.
This commit is contained in:
parent
7b2d034769
commit
922b31ebbd
2 changed files with 5 additions and 3 deletions
|
@ -457,7 +457,7 @@ bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string &directo
|
||||||
if (virtual_name == "." || virtual_name == "..")
|
if (virtual_name == "." || virtual_name == "..")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
unsigned ret_entries;
|
unsigned ret_entries = 0;
|
||||||
if (!callback(&ret_entries, directory, virtual_name)) {
|
if (!callback(&ret_entries, directory, virtual_name)) {
|
||||||
callback_error = true;
|
callback_error = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -139,7 +139,7 @@ bool DiskFile::Close() const {
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
DiskDirectory::DiskDirectory(const DiskArchive& archive, const Path& path) {
|
DiskDirectory::DiskDirectory(const DiskArchive& archive, const Path& path) : directory() {
|
||||||
// TODO(Link Mauve): normalize path into an absolute path without "..", it can currently bypass
|
// TODO(Link Mauve): normalize path into an absolute path without "..", it can currently bypass
|
||||||
// the root directory we set while opening the archive.
|
// the root directory we set while opening the archive.
|
||||||
// For example, opening /../../usr/bin can give the emulated program your installed programs.
|
// For example, opening /../../usr/bin can give the emulated program your installed programs.
|
||||||
|
@ -149,7 +149,9 @@ DiskDirectory::DiskDirectory(const DiskArchive& archive, const Path& path) {
|
||||||
bool DiskDirectory::Open() {
|
bool DiskDirectory::Open() {
|
||||||
if (!FileUtil::IsDirectory(path))
|
if (!FileUtil::IsDirectory(path))
|
||||||
return false;
|
return false;
|
||||||
FileUtil::ScanDirectoryTree(path, directory);
|
unsigned size = FileUtil::ScanDirectoryTree(path, directory);
|
||||||
|
directory.size = size;
|
||||||
|
directory.isDirectory = true;
|
||||||
children_iterator = directory.children.begin();
|
children_iterator = directory.children.begin();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue