diff --git a/main.cpp b/main.cpp index 924d948..24348b2 100644 --- a/main.cpp +++ b/main.cpp @@ -19,6 +19,7 @@ struct TreeNode { std::filesystem::file_type type; int inode; + int link_count; std::string name; int parent; int mode; @@ -59,6 +60,7 @@ TreeNode parse(const std::filesystem::path& p, int& next_inode, int& parent_inod node.atime = static_cast(buf.st_atime); node.ctime = static_cast(buf.st_ctime); node.size = static_cast(buf.st_size); + node.link_count = static_cast(buf.st_nlink); } if(node.type == std::filesystem::file_type::directory) { @@ -249,6 +251,7 @@ JsonValue to_json(const TreeNode& node) { obj["type"] = file_type_to_string(node.type); obj["inode"] = node.inode; + obj["link_count"] = node.link_count; obj["name"] = node.name; obj["parent"] = node.parent; obj["mode"] = node.mode;