delete get/set and replace persist_path
This commit is contained in:
parent
b887fa1328
commit
f7d44fc073
|
@ -1,22 +1,5 @@
|
||||||
#include "sicccPersister.H"
|
#include "sicccPersister.H"
|
||||||
|
|
||||||
/*TODO
|
|
||||||
* check if path is valid
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
SicccPersister::set_persist_path(std::string &s)
|
|
||||||
{
|
|
||||||
assert(!s.empty());
|
|
||||||
perists_path = s;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
SicccPersister::set_json_filename(std::string &s)
|
|
||||||
{
|
|
||||||
assert(!s.empty());
|
|
||||||
json_file_name = s;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
SicccPersister::write_sicccfile(const Sicccobject& so)
|
SicccPersister::write_sicccfile(const Sicccobject& so)
|
||||||
{
|
{
|
||||||
|
@ -34,7 +17,7 @@ int
|
||||||
SicccPersister::write_sicccfile()
|
SicccPersister::write_sicccfile()
|
||||||
{
|
{
|
||||||
assert(!json_file_name.empty());
|
assert(!json_file_name.empty());
|
||||||
std::string store_str = perists_path + "/" + beautify_filename();
|
std::string store_str = merouterin.get_persist_path() + "/" + beautify_filename();
|
||||||
assert(root);
|
assert(root);
|
||||||
int ret = json_dump_file(root, store_str.c_str(), JSON_INDENT(4));
|
int ret = json_dump_file(root, store_str.c_str(), JSON_INDENT(4));
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -54,7 +37,7 @@ SicccPersister::read_sicccdir()
|
||||||
struct dirent *entry = nullptr;
|
struct dirent *entry = nullptr;
|
||||||
std::vector<Sicccobject> v;
|
std::vector<Sicccobject> v;
|
||||||
json_error_t *error = nullptr;
|
json_error_t *error = nullptr;
|
||||||
if ((dir = opendir(perists_path.c_str())) == NULL) {
|
if ((dir = opendir(merouterin.get_persist_path().c_str())) == NULL) {
|
||||||
std::cerr << "Error could not open directory" << std::endl;
|
std::cerr << "Error could not open directory" << std::endl;
|
||||||
return v; // should throw exception instea1d
|
return v; // should throw exception instea1d
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue