aboutsummaryrefslogtreecommitdiffstats
path: root/common/project.cc
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2018-08-10 19:11:30 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2018-08-10 19:11:30 +0200
commite5006d4f2f767aab5c06d4e95151687a54902ad9 (patch)
treed84b3f03583ba799f31606cc9a68d14e00c842eb /common/project.cc
parent93a0d2456086b2c0e4a50d6ecc43ab028895bcad (diff)
downloadnextpnr-e5006d4f2f767aab5c06d4e95151687a54902ad9.tar.gz
nextpnr-e5006d4f2f767aab5c06d4e95151687a54902ad9.tar.bz2
nextpnr-e5006d4f2f767aab5c06d4e95151687a54902ad9.zip
Save settings and give nicer names to some
Diffstat (limited to 'common/project.cc')
-rw-r--r--common/project.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/common/project.cc b/common/project.cc
index 949f6878..8ee78c4a 100644
--- a/common/project.cc
+++ b/common/project.cc
@@ -18,6 +18,7 @@
*/
#include "project.h"
+#include <algorithm>
#include <boost/filesystem/convenience.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <fstream>
@@ -64,11 +65,18 @@ void ProjectHandler::save(Context *ctx, std::string filename)
root.put("project.name", boost::filesystem::basename(filename));
root.put("project.arch.name", ctx->archId().c_str(ctx));
root.put("project.arch.type", ctx->archArgsToId(ctx->archArgs()).c_str(ctx));
- std::string fn = ctx->settings[ctx->id("project/input/json")];
+ std::string fn = ctx->settings[ctx->id("input/json")];
root.put("project.input.json", make_relative(fn, proj.parent_path()).string());
root.put("project.params.freq", int(ctx->target_freq / 1e6));
root.put("project.params.seed", ctx->rngstate);
saveArch(ctx, root, proj.parent_path().string());
+ for(auto const &item : ctx->settings)
+ {
+ std::string path = "project.settings.";
+ path += item.first.c_str(ctx);
+ std::replace(path.begin(), path.end(), '/', '.');
+ root.put(path, item.second);
+ }
pt::write_json(f, root);
} catch (...) {
log_error("Error saving project file.\n");