Add support for isolated files.
I call isolated those files that are just lying there withot a corresponding .metadata file.
This commit is contained in:
parent
2ce7f4cfaf
commit
5f41af76b4
1 changed files with 7 additions and 2 deletions
9
main.cpp
9
main.cpp
|
@ -41,6 +41,7 @@ struct NotebookInfo {
|
||||||
std::uint64_t version = 0;
|
std::uint64_t version = 0;
|
||||||
std::uintmax_t total_size = 0;
|
std::uintmax_t total_size = 0;
|
||||||
bool deleted = false;
|
bool deleted = false;
|
||||||
|
bool isolated = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Node {
|
struct Node {
|
||||||
|
@ -106,6 +107,7 @@ NotebookMapType build_notebook_infos (
|
||||||
curr_info.type = json_doc["type"];
|
curr_info.type = json_doc["type"];
|
||||||
curr_info.version = json_doc["version"];
|
curr_info.version = json_doc["version"];
|
||||||
curr_info.visible_name = json_doc["visibleName"];
|
curr_info.visible_name = json_doc["visibleName"];
|
||||||
|
curr_info.isolated = false;
|
||||||
}
|
}
|
||||||
else if (fs::is_directory(entry)) {
|
else if (fs::is_directory(entry)) {
|
||||||
for (const auto& subentry : fs::recursive_directory_iterator(entry)) {
|
for (const auto& subentry : fs::recursive_directory_iterator(entry)) {
|
||||||
|
@ -167,9 +169,12 @@ std::vector<Node> to_tree (const NotebookMapType& nbs) {
|
||||||
|
|
||||||
return roots;
|
return roots;
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_tree (const Node& tree, std::string_view desc={}, std::string indent={}) {
|
void print_tree (const Node& tree, std::string_view desc={}, std::string indent={}) {
|
||||||
std::cout << indent << desc << " (\"" << tree.name << "\")";
|
std::cout << indent << desc << " (\"" << tree.name << "\")";
|
||||||
if (tree.info and tree.info->deleted)
|
if (tree.info && tree.info->isolated)
|
||||||
|
std::cout << " ISOLATED";
|
||||||
|
else if (tree.info and tree.info->deleted)
|
||||||
std::cout << " DELETED";
|
std::cout << " DELETED";
|
||||||
std::cout << '\n';
|
std::cout << '\n';
|
||||||
|
|
||||||
|
@ -200,7 +205,7 @@ std::vector<const NotebookInfo*> to_flat_notebook_list (const Node& tree) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<const NotebookInfo*> make_dele_list (const Node& tree) {
|
std::vector<const NotebookInfo*> make_dele_list (const Node& tree) {
|
||||||
if (tree.info and tree.info->deleted)
|
if (tree.info and (tree.info->deleted or tree.info->isolated))
|
||||||
return to_flat_notebook_list(tree);
|
return to_flat_notebook_list(tree);
|
||||||
|
|
||||||
std::vector<const NotebookInfo*> retval;
|
std::vector<const NotebookInfo*> retval;
|
||||||
|
|
Loading…
Reference in a new issue