small bugfix adding missing link_count field
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
struct TreeNode {
|
struct TreeNode {
|
||||||
std::filesystem::file_type type;
|
std::filesystem::file_type type;
|
||||||
int inode;
|
int inode;
|
||||||
|
int link_count;
|
||||||
std::string name;
|
std::string name;
|
||||||
int parent;
|
int parent;
|
||||||
int mode;
|
int mode;
|
||||||
@@ -59,6 +60,7 @@ TreeNode parse(const std::filesystem::path& p, int& next_inode, int& parent_inod
|
|||||||
node.atime = static_cast<int64_t>(buf.st_atime);
|
node.atime = static_cast<int64_t>(buf.st_atime);
|
||||||
node.ctime = static_cast<int64_t>(buf.st_ctime);
|
node.ctime = static_cast<int64_t>(buf.st_ctime);
|
||||||
node.size = static_cast<int>(buf.st_size);
|
node.size = static_cast<int>(buf.st_size);
|
||||||
|
node.link_count = static_cast<int>(buf.st_nlink);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(node.type == std::filesystem::file_type::directory) {
|
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["type"] = file_type_to_string(node.type);
|
||||||
obj["inode"] = node.inode;
|
obj["inode"] = node.inode;
|
||||||
|
obj["link_count"] = node.link_count;
|
||||||
obj["name"] = node.name;
|
obj["name"] = node.name;
|
||||||
obj["parent"] = node.parent;
|
obj["parent"] = node.parent;
|
||||||
obj["mode"] = node.mode;
|
obj["mode"] = node.mode;
|
||||||
|
|||||||
Reference in New Issue
Block a user