mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-19 15:58:56 +00:00
PackageManager: Inform the user if AvailablePorts.md doesn't exist
If we need to read from /usr/Ports/AvailablePorts.md, but the file does not exist, then warn the user in an informative way.
This commit is contained in:
parent
77d32fcb5f
commit
4303965986
Notes:
sideshowbarker
2024-07-17 02:06:40 +09:00
Author: https://github.com/supercomputer7
Commit: 4303965986
Pull-request: https://github.com/SerenityOS/serenity/pull/21099
Issue: https://github.com/SerenityOS/serenity/issues/21015
1 changed files with 4 additions and 0 deletions
|
@ -123,6 +123,10 @@ static ErrorOr<String> extract_port_name_from_column(Markdown::Table::Column con
|
|||
|
||||
ErrorOr<HashMap<String, AvailablePort>> AvailablePort::read_available_ports_list()
|
||||
{
|
||||
if (Core::System::access("/usr/Ports/AvailablePorts.md"sv, R_OK).is_error()) {
|
||||
warnln("pkg: /usr/Ports/AvailablePorts.md doesn't exist, did you run pkg -u first?");
|
||||
return Error::from_errno(ENOENT);
|
||||
}
|
||||
auto available_ports_file = TRY(Core::File::open("/usr/Ports/AvailablePorts.md"sv, Core::File::OpenMode::Read, 0600));
|
||||
auto content_buffer = TRY(available_ports_file->read_until_eof());
|
||||
auto content = StringView(content_buffer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue