Browse Source

Central location for pkg catalog db file

default_compile_flags
vector-of-bool 4 years ago
parent
commit
bcf2516533
2 changed files with 5 additions and 0 deletions
  1. +3
    -0
      src/dds/catalog/catalog.cpp
  2. +2
    -0
      src/dds/catalog/catalog.hpp

+ 3
- 0
src/dds/catalog/catalog.cpp View File

#include <dds/error/errors.hpp> #include <dds/error/errors.hpp>
#include <dds/solve/solve.hpp> #include <dds/solve/solve.hpp>
#include <dds/util/log.hpp> #include <dds/util/log.hpp>
#include <dds/util/paths.hpp>


#include <json5/parse_data.hpp> #include <json5/parse_data.hpp>
#include <neo/assert.hpp> #include <neo/assert.hpp>


} // namespace } // namespace


fs::path catalog::default_path() noexcept { return dds_data_dir() / "catalog.db"; }

catalog catalog::open(const std::string& db_path) { catalog catalog::open(const std::string& db_path) {
if (db_path != ":memory:") { if (db_path != ":memory:") {
auto pardir = fs::weakly_canonical(db_path).parent_path(); auto pardir = fs::weakly_canonical(db_path).parent_path();

+ 2
- 0
src/dds/catalog/catalog.hpp View File

static catalog open(const std::string& db_path); static catalog open(const std::string& db_path);
static catalog open(path_ref db_path) { return open(db_path.string()); } static catalog open(path_ref db_path) { return open(db_path.string()); }


static fs::path default_path() noexcept;

void store(const package_info& info); void store(const package_info& info);
std::optional<package_info> get(const package_id& id) const noexcept; std::optional<package_info> get(const package_id& id) const noexcept;



Loading…
Cancel
Save