//! Saving for boost::filesystem::directory_entry template <class Archive> inline void save(Archive & ar, ::boost::filesystem::directory_entry const & de) { ar( _CEREAL_NVP("path", de.path())); ar( _CEREAL_NVP("status", de.status())); ar( _CEREAL_NVP("symlink_status", de.symlink_status())); }
// Ignore system and hidden files, which may be created by the DropBox synchronisation process. // https://github.com/prusa3d/Slic3r/issues/1298 bool is_plain_file(const boost::filesystem::directory_entry &dir_entry) { if (! boost::filesystem::is_regular_file(dir_entry.status())) return false; #ifdef _MSC_VER DWORD attributes = GetFileAttributesW(boost::nowide::widen(dir_entry.path().string()).c_str()); return (attributes & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) == 0; #else return true; #endif }
std::vector< Value > DirectoryInfo::Traverse( Bool wantsFileNotDir ) const { Iterator iter( *m_path ); Iterator end; std::vector< Value > values; for ( ; iter != end; ++ iter ) { const boost::filesystem::directory_entry entry = *iter; const boost::filesystem::file_status status = entry.status(); const Bool accepts = wantsFileNotDir ? boost::filesystem::is_regular_file( status ) : boost::filesystem::is_directory( status ); if ( accepts ) { values.push_back( Value( std::make_shared< PathImpl >( entry.path() ) )); } } return values; }