示例#1
0
            //! 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()));
   }
示例#2
0
文件: utils.cpp 项目: prusa3d/Slic3r
// 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
}
示例#3
0
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;
}
示例#4
0
文件: utils.cpp 项目: prusa3d/Slic3r
bool is_idx_file(const boost::filesystem::directory_entry &dir_entry)
{
	return is_plain_file(dir_entry) && strcasecmp(dir_entry.path().extension().string().c_str(), ".idx") == 0;
}
示例#5
-1
void FileManager::addToVector(boost::filesystem::directory_entry entry)
{
    //verification over the entry to make sure it's not already in the map
    std::string file = entry.path().filename().string();
    file = file.substr(0,file.find_last_of('.'));
    //check if the file isn't already registered in the vector
    it = std::find_if(_files.begin(), _files.end(),
             [file](const File & m) -> bool { return m.getFilename() == file; });
    if(it == _files.end())
    {
        bool is_valid(false);
        std::string extension = entry.path().extension().string();
        extension = extension.substr(extension.find_last_of('.')+1);
        for(int i=0; i < NUMBER_OF_EXTENSION; i++)//verification over the extension
        {
            if(EXTENSIONS_VALIDES[i].compare(extension) == 0)
                is_valid = true;
        }
        if(is_valid)
        {
            _fileMaker.setProperties(entry);
            _files.push_back(*_fileMaker.getFile());
            //displayMap(); //just for test actually (maybe i've forgot about this comment :^)
        }
    }
}