76 static const string_t FIELD_SIZE; |
76 static const string_t FIELD_SIZE; |
77 static const string_t FIELD_PATH_ABSOLUTE; |
77 static const string_t FIELD_PATH_ABSOLUTE; |
78 static const string_t FIELD_PATH_CANONICAL; |
78 static const string_t FIELD_PATH_CANONICAL; |
79 static const string_t FIELD_TYPE; |
79 static const string_t FIELD_TYPE; |
80 static const string_t FIELD_SYMLINK_TARGET_TYPE; |
80 static const string_t FIELD_SYMLINK_TARGET_TYPE; |
|
81 static const string_t FIELD_SYMLINK_TARGET; |
81 static const string_t FIELD_OWNER; |
82 static const string_t FIELD_OWNER; |
82 static const string_t FIELD_GROUP; |
83 static const string_t FIELD_GROUP; |
83 |
84 |
84 virtual vector<AttributeMetadata> toMetadata(const RequestedField& field) override { |
85 virtual vector<AttributeMetadata> toMetadata(const RequestedField& field) override { |
85 if (field.group == RequestedField::GROUP_FILE) { |
86 if (field.group == RequestedField::GROUP_FILE) { |
116 writer->writeAttribute(fs::canonical(currentFile).wstring()); |
117 writer->writeAttribute(fs::canonical(currentFile).wstring()); |
117 } else if (field.name == FIELD_TYPE) { |
118 } else if (field.name == FIELD_TYPE) { |
118 writer->writeAttribute(getType(currentFile, true)); |
119 writer->writeAttribute(getType(currentFile, true)); |
119 } else if (field.name == FIELD_SYMLINK_TARGET_TYPE) { |
120 } else if (field.name == FIELD_SYMLINK_TARGET_TYPE) { |
120 writer->writeAttribute(getType(currentFile, false)); |
121 writer->writeAttribute(getType(currentFile, false)); |
|
122 } else if (field.name == FIELD_SYMLINK_TARGET) { |
|
123 writer->writeAttribute(fs::is_symlink(currentFile) ? fs::read_symlink(currentFile).wstring() : L""); // TODO: null value (when supported) |
121 } else if (field.name == FIELD_SIZE) { |
124 } else if (field.name == FIELD_SIZE) { |
122 integer_t size = fs::is_regular_file(currentFile) ? fs::file_size(currentFile) : 0; |
125 integer_t size = fs::is_regular_file(currentFile) ? fs::file_size(currentFile) : 0; |
123 writer->writeAttribute(&size, typeid (size)); |
126 writer->writeAttribute(&size, typeid (size)); |
124 } else if (field.name == FIELD_OWNER) { |
127 } else if (field.name == FIELD_OWNER) { |
125 if (currentOwner.empty()) fetchOwner(currentFile, currentOwner, currentGroup); |
128 if (currentOwner.empty()) fetchOwner(currentFile, currentOwner, currentGroup); |
144 const string_t FileAttributeFinder::FIELD_SIZE = L"size"; |
147 const string_t FileAttributeFinder::FIELD_SIZE = L"size"; |
145 const string_t FileAttributeFinder::FIELD_PATH_ABSOLUTE = L"path_absolute"; |
148 const string_t FileAttributeFinder::FIELD_PATH_ABSOLUTE = L"path_absolute"; |
146 const string_t FileAttributeFinder::FIELD_PATH_CANONICAL = L"path_canonical"; |
149 const string_t FileAttributeFinder::FIELD_PATH_CANONICAL = L"path_canonical"; |
147 const string_t FileAttributeFinder::FIELD_TYPE = L"type"; |
150 const string_t FileAttributeFinder::FIELD_TYPE = L"type"; |
148 const string_t FileAttributeFinder::FIELD_SYMLINK_TARGET_TYPE = L"symlink_target_type"; |
151 const string_t FileAttributeFinder::FIELD_SYMLINK_TARGET_TYPE = L"symlink_target_type"; |
|
152 const string_t FileAttributeFinder::FIELD_SYMLINK_TARGET = L"symlink_target"; |
149 const string_t FileAttributeFinder::FIELD_OWNER = L"owner"; |
153 const string_t FileAttributeFinder::FIELD_OWNER = L"owner"; |
150 const string_t FileAttributeFinder::FIELD_GROUP = L"group"; |
154 const string_t FileAttributeFinder::FIELD_GROUP = L"group"; |
151 |
155 |
152 } |
156 } |
153 } |
157 } |