84 |
84 |
85 writer->startRelation(L"filesystem", attributesMetadata, true); |
85 writer->startRelation(L"filesystem", attributesMetadata, true); |
86 |
86 |
87 |
87 |
88 for (std::stringstream originalName; readNext(input, originalName); reset(originalName)) { |
88 for (std::stringstream originalName; readNext(input, originalName); reset(originalName)) { |
89 |
89 fs::path file(originalName.str().empty() ? "." : originalName.str()); // interpret empty string as current directory (e.g. result of: find -printf '%P\0') |
90 fs::path file(originalName.str()); |
|
91 bool exists = false; |
90 bool exists = false; |
92 |
91 |
93 try { |
92 try { |
94 exists = fs::exists(file); |
93 exists = fs::exists(file); |
95 } catch (const fs::filesystem_error& e) { |
94 } catch (const fs::filesystem_error& e) { |
96 // we probably do not have permissions to given directory → pretend that the file does not exist |
95 // we probably do not have permissions to given directory → pretend that the file does not exist |
97 } |
96 } |
98 |
97 |
99 for (auto& finder : attributeFinders) finder.second->startFile(file); |
98 for (auto& finder : attributeFinders) finder.second->startFile(file, originalName.str()); |
100 |
99 |
101 for (RequestedField field : configuration.fields) { |
100 for (RequestedField field : configuration.fields) { |
102 AttributeFinder* finder = attributeFinders[field.group]; // should not be nullptr, because already checked while writing the relation metadata |
101 AttributeFinder* finder = attributeFinders[field.group]; // should not be nullptr, because already checked while writing the relation metadata |
103 |
102 |
104 // TODO: links to non-existent files are currently treated as non-existent files → we still can return the type and symlink_target values |
103 // TODO: links to non-existent files are currently treated as non-existent files → we still can return the type and symlink_target values |