fixed path names

This commit is contained in:
blastmaster 2014-05-02 00:41:38 +02:00
parent b181c1906b
commit 44f77648f5
5 changed files with 10 additions and 10 deletions

View File

@ -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_path() + u8"\">"; //we could include baseurl here?
output += u8"<a href=\"" + m_merouterin->get_baseurl() + it.get_filepath() + u8"\">"; //we could include baseurl here?
output += it.get_filename();
output += u8"</a> <span class=\"size\">";
output += it.get_pretty_sized();

View File

@ -84,7 +84,7 @@ class SicccPersister
json_t *root = json_object();
json_object_set_new(root, "filename", get_json_from_string(so.get_filename()));
json_object_set_new(root, "filetype", get_json_from_string(so.get_filetype()));
json_object_set_new(root, "path", get_json_from_string(so.get_path()));
json_object_set_new(root, "path", get_json_from_string(so.get_filepath()));
json_object_set_new(root, "size", get_json_from_integer(so.get_size()));
std::string tmp = time_to_string(so.get_uploadtime());
json_object_set_new(root, "upload_time", get_json_from_string(tmp));
@ -110,7 +110,7 @@ class SicccPersister
struct dirent *entry = nullptr;
std::vector<Sicccobject> v;
json_error_t *error = nullptr;
if ((dir = opendir(merouter.get_persist_path().c_str())) == NULL) {
if ((dir = opendir(merouter.get_json_path().c_str())) == NULL) {
std::cerr << "Error could not open directory" << std::endl;
return v; // should throw exception instea1d
}
@ -155,7 +155,6 @@ class SicccPersister
int write_sicccfile(const Sicccobject&);
int write_sicccfile();
/* std::vector<Sicccobject> read_sicccdir(); */
Sicccobject read_json(const std::string&);
Sicccobject read_json() { return read_json(json_file_name); }

View File

@ -17,7 +17,7 @@ int
SicccPersister::write_sicccfile()
{
assert(!json_file_name.empty());
std::string store_str = merouter.get_persist_path() + "/" + beautify_filename();
std::string store_str = merouter.get_json_path() + "/" + beautify_filename();
assert(root);
int ret = json_dump_file(root, store_str.c_str(), JSON_INDENT(4));
return ret;

View File

@ -18,7 +18,7 @@ class Sicccobject {
const size_t sz)
: filename(file),
filetype(ftype),
path(fpath),
filepath(fpath),
size(sz)
{
upload_date = std::chrono::system_clock::now();
@ -30,7 +30,7 @@ class Sicccobject {
const size_t sz)
: filename(file),
filetype(ftype),
path(fpath),
filepath(fpath),
size(sz)
{
upload_date = std::chrono::system_clock::now();
@ -43,7 +43,7 @@ class Sicccobject {
const std::chrono::time_point<std::chrono::system_clock>& date)
: filename(file),
filetype(ftype),
path(fpath),
filepath(fpath),
size(sz),
upload_date(date) { }
@ -54,7 +54,7 @@ class Sicccobject {
std::string get_filename() const { return filename; }
std::string get_filetype() const { return filetype; }
std::string get_path() const { return path; }
std::string get_filepath() const { return filepath; }
size_t get_size() const { return size; }
std::chrono::time_point<std::chrono::system_clock>
get_uploadtime() const { return upload_date; }
@ -77,7 +77,7 @@ class Sicccobject {
private:
std::string filename;
std::string filetype;
std::string path;
std::string filepath;
size_t size;
std::chrono::time_point<std::chrono::system_clock> upload_date;
};

View File

@ -32,6 +32,7 @@ class MongooseHandler{
Routerin *routerin = Routerin::get_instance();
routerin->set_baseurl(baseurl);
routerin->set_persist_path();
std::snprintf(portstring,8,"%d",this->listenport);
const char *options[] =