Ejemplo n.º 1
0
static string filename( const boost::filesystem::directory_iterator & i )
{
#if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION == 3
    return i->path().native();
#else
    return i->string();
#endif
}
Ejemplo n.º 2
0
/// check if the file extension specified by 'it' matches with one from exts
/// @param  itr    extension string
/// @param  exts   list to extensions to look for matches
/// @return        true if exts is empty or if match found
bool isExtensionMatches(const fs::directory_iterator& itr, const std::set<string_t>& exts)
{
    string_t e = itr->path().extension().string();
    e = Poco::toLower(e);
    if (!e.empty())
        e = e.substr(1);
    return (exts.empty() || exts.find( e ) != exts.end());
}
Ejemplo n.º 3
-1
void dir::addToDirObject(fs::directory_iterator in_iter,comProto::fileType::type fileTypeIn){
   comProto::directory tmpDir;
   comProto::file tmpFile;
   std::string temp=in_iter->path().filename().string(); 
   std::cout << "----Filename String: " << temp << std::endl;
   std::cout << "----Filename Type:" << fileTypeIn << std::endl;
   if(fileTypeIn==comProto::fileType::type::File){
      std::cout << "----size: " << fs::file_size(in_iter->path()) << std::endl; 
      uintmax_t size =  fs::file_size(in_iter->path());
      double sizeD = double(size);
      tmpFile.__set_size(sizeD);
   }
   tmpFile.__set_name(temp);
   tmpFile.__set_thefileType(fileTypeIn);
   _files.push_back(tmpFile); 
   _directory.__set_files(_files);         
}