mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
PartitionEditor: Migrate to Directory::for_each_entry()
This commit is contained in:
parent
3c25a9b5fe
commit
8110cf9fab
1 changed files with 8 additions and 7 deletions
|
@ -7,7 +7,7 @@
|
|||
#include <Applications/PartitionEditor/PartitionEditorWindowGML.h>
|
||||
#include <Applications/PartitionEditor/PartitionModel.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/Directory.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/ComboBox.h>
|
||||
|
@ -20,12 +20,13 @@
|
|||
static Vector<DeprecatedString> get_device_paths()
|
||||
{
|
||||
auto device_paths = Vector<DeprecatedString>();
|
||||
Core::DirIterator iterator("/dev", Core::DirIterator::SkipParentAndBaseDir);
|
||||
while (iterator.has_next()) {
|
||||
auto path = iterator.next_full_path();
|
||||
if (Core::DeprecatedFile::is_block_device(path))
|
||||
device_paths.append(path);
|
||||
}
|
||||
// FIXME: Propagate errors.
|
||||
(void)Core::Directory::for_each_entry("/dev"sv, Core::DirIterator::Flags::SkipParentAndBaseDir, [&](auto const& entry, auto const& directory) -> ErrorOr<IterationDecision> {
|
||||
auto full_path = LexicalPath::join(directory.path().string(), entry.name).string();
|
||||
if (Core::DeprecatedFile::is_block_device(full_path))
|
||||
device_paths.append(full_path);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
return device_paths;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue