From 926ecf964047f7ab23ee2c086d826688c5228c96 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 5 Dec 2017 14:50:59 -0800 Subject: docs --- controller/FileDB.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'controller/FileDB.cpp') diff --git a/controller/FileDB.cpp b/controller/FileDB.cpp index 728cec6b..3f8564fa 100644 --- a/controller/FileDB.cpp +++ b/controller/FileDB.cpp @@ -27,6 +27,9 @@ FileDB::FileDB(EmbeddedNetworkController *const nc,const Address &myAddress,cons { OSUtils::mkdir(_path.c_str()); OSUtils::lockDownFile(_path.c_str(),true); + OSUtils::mkdir((_path + ZT_PATH_SEPARATOR + "network").c_str()); + OSUtils::mkdir((_path + ZT_PATH_SEPARATOR + "network" + ZT_PATH_SEPARATOR_S + "member").c_str()); + OSUtils::mkdir((_path + ZT_PATH_SEPARATOR + "trace").c_str()); std::vector networks(OSUtils::listDirectory(_networksPath.c_str(),false)); std::string buf; @@ -106,8 +109,10 @@ void FileDB::save(nlohmann::json *orig,nlohmann::json &record) } } else if (objtype == "trace") { const std::string id = rec["id"]; - OSUtils::ztsnprintf(p1,sizeof(p1),"%s" ZT_PATH_SEPARATOR_S "trace" ZT_PATH_SEPARATOR_S "%s.json",_path.c_str(),id.c_str()); - OSUtils::writeFile(p1,OSUtils::jsonDump(rec,-1)); + if (id.length() > 0) { + OSUtils::ztsnprintf(p1,sizeof(p1),"%s" ZT_PATH_SEPARATOR_S "trace" ZT_PATH_SEPARATOR_S "%s.json",_path.c_str(),id.c_str()); + OSUtils::writeFile(p1,OSUtils::jsonDump(rec,-1)); + } } } catch ( ... ) {} // drop invalid records missing fields } -- cgit v1.2.3