mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +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
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