@ -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
// 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.
std : : string absolute_path = archive - > GetMountPoint ( ) + path . AsString ( ) ;
this - > path = archive - > GetMountPoint ( ) + path . AsString ( ) ;
FileUtil : : ScanDirectoryTree ( absolute_path , directory ) ;
children_iterator = directory . children . begin ( ) ;
}
}
Directory_SDMC : : ~ Directory_SDMC ( ) {
Directory_SDMC : : ~ Directory_SDMC ( ) {
Close ( ) ;
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
* List files contained in the directory
* @ param count Number of entries to return at once in entries
* @ param count Number of entries to return at once in entries