Browse Source

package.dds can store a version number

default_compile_flags
vector-of-bool 5 years ago
parent
commit
b6d431eaee
2 changed files with 7 additions and 9 deletions
  1. +6
    -9
      src/dds/package_manifest.cpp
  2. +1
    -0
      src/dds/package_manifest.hpp

+ 6
- 9
src/dds/package_manifest.cpp View File

@@ -7,15 +7,12 @@
using namespace dds;

package_manifest package_manifest::load_from_file(const fs::path& fpath) {
auto kvs = lm::parse_file(fpath);
auto kvs = lm::parse_file(fpath);
package_manifest ret;
for (auto& pair : kvs.items()) {
if (pair.key() == "Name") {
ret.name = pair.value();
} else {
throw std::runtime_error(
fmt::format("Unknown key in file '{}': {}", fpath.string(), pair.key()));
}
}
lm::read(fmt::format("Reading package manifest '{}'", fpath.string()),
kvs,
lm::read_opt("Name", ret.name),
lm::read_opt("Version", ret.version),
lm::reject_unknown());
return ret;
}

+ 1
- 0
src/dds/package_manifest.hpp View File

@@ -8,6 +8,7 @@ namespace dds {

struct package_manifest {
std::string name;
std::string version = "no-version";

static package_manifest load_from_file(path_ref);
};

Loading…
Cancel
Save