Sfoglia il codice sorgente

package.dds can store a version number

default_compile_flags
vector-of-bool 5 anni fa
parent
commit
b6d431eaee
2 ha cambiato i file con 7 aggiunte e 9 eliminazioni
  1. +6
    -9
      src/dds/package_manifest.cpp
  2. +1
    -0
      src/dds/package_manifest.hpp

+ 6
- 9
src/dds/package_manifest.cpp Vedi 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 Vedi 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…
Annulla
Salva