src/FilesystemCommand.h
branchv_0
changeset 9 b4f29fb16159
parent 8 eb1ecb37c6b7
child 16 6180161335be
equal deleted inserted replaced
8:eb1ecb37c6b7 9:b4f29fb16159
    93 				exists = fs::exists(file);
    93 				exists = fs::exists(file);
    94 			} catch (const fs::filesystem_error& e) {
    94 			} catch (const fs::filesystem_error& e) {
    95 				// 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
    96 			}
    96 			}
    97 
    97 
    98 			for (auto& finder : attributeFinders) finder.second->startFile(file, originalName.str());
    98 			for (auto& finder : attributeFinders) finder.second->startFile(file, originalName.str(), exists);
    99 
    99 
   100 			for (RequestedField field : configuration.fields) {
   100 			for (RequestedField field : configuration.fields) {
   101 				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
   102 
   102 				finder->writeField(writer.get(), field);
   103 				// TODO: links to non-existent files are currently treated as non-existent files → we still can return the type and symlink_target values
       
   104 				if (exists || (field.group == RequestedField::GROUP_FILE && field.name == FileAttributeFinder::FIELD_PATH_ORIGINAL)) {
       
   105 					finder->writeField(writer.get(), field);
       
   106 				} else {
       
   107 					finder->writeEmptyField(writer.get(), field);
       
   108 				}
       
   109 			}
   103 			}
   110 
   104 
   111 			for (auto& finder : attributeFinders) finder.second->endFile();
   105 			for (auto& finder : attributeFinders) finder.second->endFile();
   112 		}
   106 		}
   113 	}
   107 	}