diff --git a/Userland/Utilities/du.cpp b/Userland/Utilities/du.cpp index 2ffd84d6fa..baf93f7c49 100644 --- a/Userland/Utilities/du.cpp +++ b/Userland/Utilities/du.cpp @@ -11,12 +11,11 @@ #include #include #include -#include +#include #include #include #include #include -#include struct DuOption { enum class TimeType { @@ -55,8 +54,8 @@ ErrorOr serenity_main(Main::Arguments arguments) ErrorOr parse_args(Main::Arguments arguments, Vector& files, DuOption& du_option) { bool summarize = false; - char const* pattern = nullptr; - char const* exclude_from = nullptr; + StringView pattern; + StringView exclude_from; Vector files_to_process; Core::ArgsParser::Option time_option { @@ -112,11 +111,11 @@ ErrorOr parse_args(Main::Arguments arguments, Vector& files, DuOpt if (summarize) du_option.max_depth = 0; - if (pattern) + if (!pattern.is_empty()) du_option.excluded_patterns.append(pattern); - if (exclude_from) { - auto file = TRY(Core::File::open(exclude_from, Core::OpenMode::ReadOnly)); - auto const buff = file->read_all(); + if (!exclude_from.is_empty()) { + auto file = TRY(Core::Stream::File::open(exclude_from, Core::Stream::OpenMode::Read)); + auto const buff = TRY(file->read_all()); if (!buff.is_empty()) { String patterns = String::copy(buff, Chomp); du_option.excluded_patterns.extend(patterns.split('\n'));