master
blastmaster 9 years ago
parent 80eccf477c
commit 9c0b563837
  1. 1
      siccc.org
  2. 2
      src/DynamicObjects.cc
  3. 7
      src/sicccPersister.H

@ -12,3 +12,4 @@
* TODO Upload (_unknown)
- 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){
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 += u8"</a> <span class=\"size\">";
output += it.get_pretty_sized();

@ -109,15 +109,18 @@ class SicccPersister
DIR *dir = nullptr;
struct dirent *entry = nullptr;
std::vector<Sicccobject> v;
std::string json_path = merouter.get_json_path();
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;
return v; // should throw exception instea1d
}
while ((entry = readdir(dir)) != NULL) {
if (std::strstr(entry->d_name, ".json") == NULL)
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);
Sicccobject so(tmp);
v.push_back(so);

Loading…
Cancel
Save