diff --git a/Userland/Utilities/pkg/InstalledPort.cpp b/Userland/Utilities/pkg/InstalledPort.cpp index ca78dbfb0c..4e51b01b21 100644 --- a/Userland/Utilities/pkg/InstalledPort.cpp +++ b/Userland/Utilities/pkg/InstalledPort.cpp @@ -11,7 +11,7 @@ ErrorOr> 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 buffer = TRY(ByteBuffer::create_uninitialized(PAGE_SIZE)); diff --git a/Userland/Utilities/pkg/InstalledPort.h b/Userland/Utilities/pkg/InstalledPort.h index 5969c72ee8..414c0a504b 100644 --- a/Userland/Utilities/pkg/InstalledPort.h +++ b/Userland/Utilities/pkg/InstalledPort.h @@ -11,6 +11,8 @@ #include #include +constexpr StringView ports_database = "/usr/Ports/installed.db"sv; + class InstalledPort { public: enum class Type { diff --git a/Userland/Utilities/pkg/main.cpp b/Userland/Utilities/pkg/main.cpp index 00b0477c29..8a4839a985 100644 --- a/Userland/Utilities/pkg/main.cpp +++ b/Userland/Utilities/pkg/main.cpp @@ -54,8 +54,8 @@ ErrorOr serenity_main(Main::Arguments arguments) HashMap installed_ports; HashMap available_ports; 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()) { - warnln("pkg: /usr/Ports/installed.md isn't accessible, did you install a package in the past?"); + if (Core::System::access(ports_database, R_OK).is_error()) { + warnln("pkg: {} isn't accessible, did you install a package in the past?", ports_database); return 1; } installed_ports = TRY(InstalledPort::read_ports_database());