fubb
This commit is contained in:
parent
80eccf477c
commit
9c0b563837
|
@ -12,3 +12,4 @@
|
||||||
* TODO Upload (_unknown)
|
* TODO Upload (_unknown)
|
||||||
- file richitig speichern (Siccobject construktor)
|
- file richitig speichern (Siccobject construktor)
|
||||||
|
|
||||||
|
* TODO [Routerin] create directories if they won't exists
|
||||||
|
|
|
@ -10,7 +10,7 @@ std::string DynamicObjects::render_object_list(){
|
||||||
|
|
||||||
for (auto& it : this->m_thevec){
|
for (auto& it : this->m_thevec){
|
||||||
output += u8"<li>\n";
|
output += u8"<li>\n";
|
||||||
output += u8"<a href=\"" + m_merouterin->get_baseurl() + it.get_filepath() + u8"\">"; //we could include baseurl here?
|
output += u8"<a href=\"" + m_merouterin->get_baseurl() + it.get_filepath() + it.get_filename() + u8"\">"; //we could include baseurl here?
|
||||||
output += it.get_filename();
|
output += it.get_filename();
|
||||||
output += u8"</a> <span class=\"size\">";
|
output += u8"</a> <span class=\"size\">";
|
||||||
output += it.get_pretty_sized();
|
output += it.get_pretty_sized();
|
||||||
|
|
|
@ -109,15 +109,18 @@ class SicccPersister
|
||||||
DIR *dir = nullptr;
|
DIR *dir = nullptr;
|
||||||
struct dirent *entry = nullptr;
|
struct dirent *entry = nullptr;
|
||||||
std::vector<Sicccobject> v;
|
std::vector<Sicccobject> v;
|
||||||
|
std::string json_path = merouter.get_json_path();
|
||||||
json_error_t *error = nullptr;
|
json_error_t *error = nullptr;
|
||||||
if ((dir = opendir(merouter.get_json_path().c_str())) == NULL) {
|
std::cout << "[DEBUG] in reading sicccdir" << std::endl;
|
||||||
|
if ((dir = opendir(json_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
|
||||||
}
|
}
|
||||||
while ((entry = readdir(dir)) != NULL) {
|
while ((entry = readdir(dir)) != NULL) {
|
||||||
if (std::strstr(entry->d_name, ".json") == NULL)
|
if (std::strstr(entry->d_name, ".json") == NULL)
|
||||||
continue;
|
continue;
|
||||||
json_t *tmp = json_load_file(entry->d_name, JSON_DECODE_ANY, error);
|
std::cout << entry->d_name << std::endl;
|
||||||
|
json_t *tmp = json_load_file((json_path + std::string(entry->d_name)).c_str(), JSON_DECODE_ANY, error);
|
||||||
assert(tmp);
|
assert(tmp);
|
||||||
Sicccobject so(tmp);
|
Sicccobject so(tmp);
|
||||||
v.push_back(so);
|
v.push_back(so);
|
||||||
|
|
Loading…
Reference in New Issue