10 #include <boost/filesystem/operations.hpp>
11 #include <boost/filesystem/exception.hpp>
12 #include <boost/lexical_cast.hpp>
16 #include <Wt/WIconPair>
17 #include <Wt/WStringUtil>
23 #if BOOST_FILESYSTEM_VERSION < 3
24 #ifndef WT_NO_STD_WSTRING
36 if (boost::filesystem::exists(path)) {
37 if (!boost::filesystem::is_directory(path)) {
38 int fsize = (int)boost::filesystem::file_size(path);
39 setColumnWidget(1,
new WText(boost::lexical_cast<std::string>(fsize)));
40 columnWidget(1)->setStyleClass(
"fsize");
44 std::time_t t = boost::filesystem::last_write_time(path);
49 localtime_r(&t, &ttm);
53 strftime(c, 100,
"%b %d %Y", &ttm);
55 setColumnWidget(2,
new WText(c));
56 columnWidget(2)->setStyleClass(
"date");
62 if (boost::filesystem::exists(path)
63 && boost::filesystem::is_directory(path))
64 return new WIconPair(
"icons/yellow-folder-closed.png",
65 "icons/yellow-folder-open.png",
false);
67 return new WIconPair(
"icons/document.png",
68 "icons/yellow-folder-open.png",
false);
74 if (boost::filesystem::is_directory(path_)) {
75 std::set<boost::filesystem::path> paths;
76 boost::filesystem::directory_iterator end_itr;
78 for (boost::filesystem::directory_iterator i(path_); i != end_itr; ++i)
81 for (std::set<boost::filesystem::path>::iterator i = paths.begin();
82 i != paths.end(); ++i)
85 }
catch (boost::filesystem::filesystem_error& e) {
86 std::cerr << e.what() << std::endl;
93 return boost::filesystem::is_directory(path_);