#include <nana/deploy.hpp>
#include <nana/gui.hpp>
#include <nana/gui/widgets/treebox.hpp>
#include <nana/filesystem/filesystem_ext.hpp>
int main()
{
using namespace nana;
namespace fs = std::filesystem;
namespace fs_ext = nana::filesystem_ext;
fm.caption("Nana C++ Library - Treebox-nana::filesystem example.");
auto node = tree.
insert(fs_ext::def_root, fs_ext::def_rootname);
try {
dir_it sub_root{ fs_ext::def_rootstr};
auto p = sub_root->path();
tree.
insert(node, dir_name,dir_name);
} catch (...) {}
{
auto Path = tree.make_key_path(arg.
item,
"/") +
"/";
tree.auto_draw(false);
try {
for (const auto& dir : dir_it{ Path })
{
std::string dir_name= dir.path().filename().generic_string();
auto child = tree.
insert(arg.
item, dir_name, dir_name);
if (child.empty()) continue;
try {
dir_it d{ dir.path() };
if (d != dir_it{})
{
std::string sdir_name = d->path().filename().generic_string();
tree.
insert(child, sdir_name, sdir_name);
}
} catch (...) {}
}
} catch (...) {}
tree.auto_draw(true);
});
fm.show();
#ifdef NANA_AUTOMATIC_GUI_TESTING
2, 1, [&node]()
{
node.expand(true);
}
#endif
);
}