equal
deleted
inserted
replaced
71 owner = convertor.from_bytes(pw->pw_name); |
71 owner = convertor.from_bytes(pw->pw_name); |
72 group = convertor.from_bytes(gr->gr_name); |
72 group = convertor.from_bytes(gr->gr_name); |
73 } |
73 } |
74 |
74 |
75 string_t getContent(const fs::path& file) { |
75 string_t getContent(const fs::path& file) { |
76 // TODO: better copy |
76 try { |
77 // not working: |
77 ifstream input(file); |
78 wifstream source(file); |
78 std::stringstream bytes; |
79 std::wstringstream result; |
79 bytes << input.rdbuf(); |
80 for (wchar_t ch; source.get(ch); source.good()) result << ch; |
|
81 return result.str(); |
|
82 |
80 |
83 //wifstream stream(file); |
81 // TODO: optional whitespace trimming or substring |
84 //std::wstringstream content; |
82 // TODO: custom encoding + read encoding from xattr |
85 //content << stream.rdbuf(); |
83 return convertor.from_bytes(bytes.str()); |
86 //return content.str(); |
84 } catch (const std::range_error& e) { |
|
85 // TODO: allow custom error value or fallback to HEX/Base64 |
|
86 return L""; |
|
87 } |
87 } |
88 } |
88 |
89 |
89 protected: |
90 protected: |
90 |
91 |
91 virtual void writeFieldOfExistingFile(RelationalWriter* writer, const RequestedField& field) override { |
92 virtual void writeFieldOfExistingFile(RelationalWriter* writer, const RequestedField& field) override { |