mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:57:45 +00:00
pkg: Always use correct installed.db
The access() check was on the wrong file previously.
This commit is contained in:
parent
feef542c73
commit
a5f566c2c6
3 changed files with 5 additions and 3 deletions
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
ErrorOr<HashMap<String, InstalledPort>> InstalledPort::read_ports_database()
|
ErrorOr<HashMap<String, InstalledPort>> InstalledPort::read_ports_database()
|
||||||
{
|
{
|
||||||
auto file = TRY(Core::File::open("/usr/Ports/installed.db"sv, Core::File::OpenMode::Read));
|
auto file = TRY(Core::File::open(ports_database, Core::File::OpenMode::Read));
|
||||||
auto buffered_file = TRY(Core::InputBufferedFile::create(move(file)));
|
auto buffered_file = TRY(Core::InputBufferedFile::create(move(file)));
|
||||||
auto buffer = TRY(ByteBuffer::create_uninitialized(PAGE_SIZE));
|
auto buffer = TRY(ByteBuffer::create_uninitialized(PAGE_SIZE));
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
|
|
||||||
|
constexpr StringView ports_database = "/usr/Ports/installed.db"sv;
|
||||||
|
|
||||||
class InstalledPort {
|
class InstalledPort {
|
||||||
public:
|
public:
|
||||||
enum class Type {
|
enum class Type {
|
||||||
|
|
|
@ -54,8 +54,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
HashMap<String, InstalledPort> installed_ports;
|
HashMap<String, InstalledPort> installed_ports;
|
||||||
HashMap<String, AvailablePort> available_ports;
|
HashMap<String, AvailablePort> available_ports;
|
||||||
if (show_all_installed_ports || show_all_dependency_ports || !query_package.is_null()) {
|
if (show_all_installed_ports || show_all_dependency_ports || !query_package.is_null()) {
|
||||||
if (Core::System::access("/usr/Ports/installed.md"sv, R_OK).is_error()) {
|
if (Core::System::access(ports_database, R_OK).is_error()) {
|
||||||
warnln("pkg: /usr/Ports/installed.md isn't accessible, did you install a package in the past?");
|
warnln("pkg: {} isn't accessible, did you install a package in the past?", ports_database);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
installed_ports = TRY(InstalledPort::read_ports_database());
|
installed_ports = TRY(InstalledPort::read_ports_database());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue